Kumail Nanjiani says the late Robin Williams was one of his heroes in life.

The comedian, who takes on a dramatic role “Welcome to Chippendales”, says he was inspired to take a darker direction with his new work because of the comedy legend.

“When I look at the people that inspired me to do comedy in the first place, someone I think of a lot is Robin Williams,” explained Nanjiani on Wednesday’s episode of “The View”. “when I think of people who started off as standup and ended up doing dark dramatic roles, it’s very hard to beat the level that he achieved in all those different areas. And I was like ‘if my heroes are doing this I have to at least try and follow in their footsteps.'”

READ MORE: ‘Welcome To Chippendales’ Costume Designer Reveals Those Tear-Away Pants Are More Complicated Than Viewers Think

Williams was well-known for his comedic roles, voicing the Genie in “Aladdin”, the desperate father in “Mrs. Doubtfire” and bringing audiences laughs in a variety of ’90s comedies. Later in his career, he also expanded his repertoire with more serious roles like his award-winning role as Sean in “Good Will Hunting”.

Nanjiani revealed that he actually met Williams once in real life prior to his death.

“Actually, my wife and I used to do this show in LA in the back of this comic book store, just a tiny little show. One day I was hosting and I came back stage and Robin Williams was standing there,” recalled the actor.

He was surprised by the sudden appearance and invited the legend to perform on the stage.

READ MORE: Who Is Dorothy Stratten? Nicola Peltz On Portraying The Playmate In ‘Welcome To Chippendales’ (Exclusive)

“I was like, ‘do you want to go up on stage?’ and he said ‘oh no, I can’t.’ ‘Are you sure?’ and before I could finish, he was like ‘I’ll just do two minutes,'” said Nanjiani. “He went on stage and did 20 minutes. It was amazing. He did so well.”

Hulu’s “Welcome to Chippendales” premieres with two episodes on Nov. 22, with one new episode rolling out weekly through Jan. 3, 2023.