The competition for the top spot at this weekend’s box office was a showdown between a live-action comedy and a star-studded animated musical, both in their opening weekends. In the end, it was the flesh-and-bone comics who won.

Universal’s “Night School,” which stars Tiffany Haddish as a teacher and Kevin Hart as one of her adult students, brought in an estimated $28 million domestically, beating out the Warner Brothers movie “Smallfoot” for the No. 1 spot.

“Night School” is the latest film from the director Malcolm D. Lee, whose 2017 comedy “Girls Trip” (also featuring Ms. Haddish) made history as the first film with an all-black creative team on both sides of the camera to earn $100 million at the box office. (That film took in about $31 million domestically during its opening weekend.) The cast for Mr. Lee’s new film also includes Romany Malco, Fat Joe, Rob Riggle, Mary Lynn Rajskub, Megalyn Echikunwoke and Taran Killam.

[Read A. O. Scott’s review of “Night School”]

“Smallfoot,” which features Common, Channing Tatum, Zendaya and other stars voicing animated yetis, brought in about $23 million domestically according to comScore, which compiles box-office data.