The state of comedy films these days is pretty dire, with only “Crazy Rich Asians” having reached the blockbuster status of earning more than $100 million this year, and “Girls Trip” and the “Jumanji” reboot being the only comedies to do so last year. The biggest part of the problem has been R-rated comedies, which have become so mired in raunchiness that often their sole reason for being is to see how far they can push the envelope on taste.

So I had a fair amount of hope for this weekend’s new entry “Night School,” since it pairs a dynamic duo of funny people in superstar Kevin Hart and rocket-powered rising talent Tiffany Haddish in a film that refreshingly seeks its laughs at a PG-13 level. It also features director Malcolm D. Lee at the helm, building off a solid streak of acclaimed hits, including “The Best Man,” “The Best Man Holiday” and “Girls Trip.” What could go wrong?

Unfortunately, the film also has six writers, a ridiculously high number that leads this occasionally funny film into being a jumbled mess with abrupt tonal shifts. It also features one of the most embarrassing film scores to be heard in years, yet somehow its underlying goofy energy and positive message about the importance of education and second chances should leave viewers feeling entertained if they’re not expecting high art.

“School” stars Hart as Teddy Walker, a fast-talking hustler who works successfully as a salesman for a store called BBQ City, selling backyard grills while cruising around Atlanta in a fancy car with a beautiful girlfriend. He’s living way beyond his means and hiding from her the fact that he’s a high school dropout. When he accidentally explodes the store while proposing to her after hours, a friend offers Teddy a job selling investments on one condition: that he finish his GED.

Teddy had always hated school, unaware that he suffered from a combination of learning disabilities that made it nearly impossible to learn anything. When he warily walks into a night school GED class taught by a sassy woman named Carrie (Haddish) and surrounded by an assortment of well-cast weirdos with unique issues of their own, he is surprised to discover a real chance to better his life.

Along the way, he’s got two other unexpected challenges: the embarrassment of working as a sign-spinner while dressed in a chicken suit for a ridiculous restaurant called Christian Chicken that’s an over-the-top spoof of Chick-Fil-A, and the fact that his old high-school nemesis Stewart (Taram Killam) is now his principal.

A key part of the film’s successes is its impressive bench of comedic supporting players, particularly Teddy’s dad (Keith David, wickedly funny, as always) and his classmates. These include a middle-aged mover who plans to use his GED to climb out of backbreaking labor and into management (Rob Riggle) and a comically terrified mouse of a housewife who gains almost too much confidence (Mary Lynn Rajskub).

Add in an African-American paranoid conspiracy theorist (Romany Malco) and a Mexican waiter who dreams of becoming a dental hygienist and a pop singer but can’t pronounce half his English correctly (Al Madrigal), and the sheer silliness of it all pulls enough laughs from the hit-or-miss script to make this a fun viewing overall.

With a storyline that doesn’t rely on dick jokes and people attempting to get laid, “Night School” deserves an A for effort but a C for its too-sloppy execution. I’ll split the difference and give it a B overall. n