Zach Braff says it’s important to still find humor after tragedy strikes.

The actor is behind the upcoming Florence Pugh Dramedy “A Good Person”, which he based on his own experience of personal loss.

Braff lost his sister Shoshana from complications of an aneurysm in 2018, and a few months later lost his father Hal to cancer.

“I knew I wanted to write about grief,” explained the writer and director to People. “Then the pandemic hit.”

READ MORE: Florence Pugh Says Starring In Ex Zach Braff’s Film ‘A Good Person’ Was ‘Very Freeing’

It was in 2020 that his close friend and former Bullets Over Broadway the Musical costar, Nick Cordero was hospitalized with severe complications after contracting COVID-19. The Broadway star had just moved into Braff’s LA home with his wife, Amanda Kloots, and their newborn son Elvis, so the actor witnessed the slow decline of his friend’s health.

“I was watching his wife, with her brand-new baby, deal with this tragedy and deal with him eventually dying,” Braff continued, describing Kloots who he attributed as one of his inspirations for the film. “I was like, ‘God, how does she start over?’ This is what came out of me.”

“A Good Person” tells the story of Pugh’s Allison, a New Jersey pharmaceutical rep who becomes addicted to painkillers to cope with the loss of her fiancé’s sister. She is plagued with guilt for being behind the wheel in the car crash that took her life. She develops a friendship with her would-be father-in-law, played by Morgan Freeman, who is a struggling alcoholic.

The “Scrubs” alum explained that while the subject matter was serious, he wanted to still keep it light and entertaining for audiences.

“I don’t want anything to be too maudlin,” he revealed. “What I try to say is, ‘There’s still humor in everyday life. And that’s what keeps a lot of us afloat.’ ”

READ MORE: Florence Pugh Seen Holding Hands With Charlie Gooch Following Zach Braff Split

Braff shared his own story of using humour to relieve the stress of his sister’s condition while waiting in the ICU.

“I remember being in the ICU waiting room for my sister, and everything was touch and go, and my whole family’s packed into this room with a half-full fish tank and bad art and a puzzle with 20 missing pieces,” he recalled. “And someone in my family says something a little bit funny, and then we all just guffaw, because we so needed a release.”

“A Good Person” is in theatres now.