Tyler Perry has spent over 15 years in heavy make-up and padding, doling out tough love as the title character of the “Madea” movies. With “A Madea Family Funeral,” the gun-toting grandmother is going out with a bang. The 11th and final installment in the long-running franchise beat box office expectations when it opened last weekend, generating a solid $27 million when it hit 2,442 North American theaters.

“Family Funeral” may not have racked up the best start in the “Madea” series — that distinction belongs to “Madea Goes to Jail” ($41 million) — but it ranks as the franchise’s second biggest debut in nearly a decade. It’s a rare feat for any franchise to keep cranking out films that are actually making money after so many installments. Tastes change, audiences move on, but Madea seems to have retained her hold on a devoted fanbase. To put the opening weekend of “A Madea Family Funeral” into perspective, it launched with just $1 million less than Fox’s “Alita: Battle Angel” ($28 million), a sci-fi epic that cost over $170 million to produce. Perry, who stars in, produces, and directs the low-cost “Madea” movies, typically makes his films for roughly $20 million.

“You have to put Madea in the pantheon of successful long-running franchises,” said Paul Dergarabedian, a senior media analysts with Comscore. “This character has resonated for over a decade and a half.”

Even without critical support (reviews for “Madea” are dismissive, at best), the series has become a dependable hit for Lionsgate, the studio that distributes most of Perry’s films. Since the partnership between Perry and Lionsgate began in 2005 with “Diary of a Mad Black Woman,” the filmmaker has made 21 movies with the studio. Those films, including not just “Madea”  have generated over $1 billion in ticket sales, according to Comscore. But now that Perry announced his plans to retire Madea, that relationship might look a little different. Perry’s pact with Lionsgate has unofficially ended as Paramount Pictures now has a first-look deal with the creator. The rights for Madea still belong to Lionsgate, and the studio can hypothetically decide to churn out more installments. Likewise, Perry can still make movies with Lionsgate if he chooses.

“Tyler Perry is an incomparable talent, and our door is always open to him,” a spokesperson for Lionsgate told Variety. “We look forward to doing more projects with him in the future.”

Perry has been a reliable moneymaker for the studio by doing what Hollywood has been slow to follow suit on — the mogul has cultivated a billion-dollar empire on movies that put the spotlight on diverse characters. Actors like Angela Bassett, Cicely Tyson, Taraji P. Henson, and Viola Davis all appeared in Perry’s movies during the early aughts of their careers. Inclusion has become a hot topic in Hollywood, but Perry doesn’t always get the credit he deserves for getting studios to realize that making more movies about people of color isn’t just a moral good. It’s good for business.

Even before the “Black Panthers,” “Crazy Rich Asians” and “Oceans 8s” of the world proved that women and people of color could have commercial appeal, Perry was harnessing the power of underrepresented audiences. It’s a group that continues to turn out for his films. African Americans accounted for 50% of “A Madea Family Funeral’s” opening weekend audience, while 61% of moviegoers were female. On average, 65% of crowds for “Madea” movies consist of black moviegoers.

“His vision speaks to audiences who don’t see themselves well represented on the big screen,” Dergarabedian said. “Perry was [encouraging diversity] years ago and has had a consistent level of success by speaking to audiences who enjoy his point of view.”

Perry also challenged studios to promote movies more efficiently at at a time when marketing costs can balloon to tens of millions of dollars. When Madea first hit the stage in the 1999 play “I Can Do Bad All by Myself,” Perry used grassroots marketing campaigns leaning heavily on outreach to the African American community to get the word out about his movies. It was a precursor to what today would be an effective social media campaign.

Perry’s departure from Madea and the Lionsgate family couldn’t come at a worse time for the studio. Lionsgate has been struggling in recent years, releasing one flop after another. The studio’s big-budget remake of “Robin Hood” was one of last year’s biggest misfires as the $100 million film ended its theatrical run with just $84 million globally. Before that, “Hunter Killer,” an action thriller starring Gerard Butler, stalled with a paltry $15 million worldwide. It carried a $40 million price tag.  One of Lionsgate’s few success stories of 2018 was “A Simple Favor,” a campy whodunit starring two female leads, Anna Kendrick and Blake Lively. It grossed almost $100 million on a $20 million budget.

The studio is hoping a “Hellboy” reboot, a third entry in the “John Wick” franchise, and “Long Shot,” a comedy with Charlize Theron and Seth Rogen, can help turn things around in 2019. Lionsgate’s first release of the year was “Cold Pursuit,” a vigilante drama that only landed on audience’s radars after its star, Liam Neeson, made controversial racially charged comments. That attention didn’t translate into ticket sales. “Cold Pursuit,” which cost $60 million to make, tapped out with $46 million globally.

With a slate like that, Lionsgate could definitely use a few more Tyler Perry movies.