Rosie O'Donnell was delighted when "Empire" creator Lee Daniels invited her to guest star on the Fox drama, then got a case of nerves.

"I'd watched the performances, and I'm stunned every week because I can't believe the level of acting and the amount of (dialogue) and stories" in each episode, O'Donnell said.

Worried about "not being on my game," she worked with an acting coach before taping.

"I prepared for this like I've never prepared for anything in my career, because I didn't want to disappoint and I understood the pace at which they work," she said.

In the episode airing Wednesday, O'Donnell plays Pepper O'Leary, a tough criminal who shared a cell for years with Cookie Lyon, played by series star Taraji P. Henson.

More On This...

Cookie seeks out Pepper to help her find missing family members, including Cookie's son Hakeem (Bryshere Y. Gray). Pepper is living in Philadelphia and back in the "criminal business," O'Donnell said.

She knows "the lowdown about what's going on in Philly" and is in a position to help Cookie, the actress-comedian said.

Playing her first baddie was "liberating," and she was honored that Daniels envisioned her in the role and trusted her to handle it, she said.

Daniels' call came a couple years after O'Donnell bumped into him at a New York theater and complimented him on the 2009 Oscar-winning film "Precious," which Daniels directed.

"I was honored and shocked and thrilled" when he called about the "Empire" role, O'Donnell said, adding that's she a fan of the show and tweets about it.

Henson was "amazing" to work with, she said.

"It's like dancing with (ballet's Mikhail) Baryshnikov, you have to be on point," O'Donnell said. "She's extraordinarily gifted."

But O'Donnell received her own gracious kudos as well, from series star Gray.

"He said, 'I just want to tell you that I have a lot of respect for who you are and how you use your voice socially,' " O'Donnell recalled. "He said everything you would dream a 20-year-old kid — like the one at home on my couch, who never says that to me — would say to you."

O'Donnell, a former co-host on "The View," appears on ABC Family's drama series "The Fosters."