Lea Michele has done it all during her six years on Glee: Broadway tunes, oldies, new hits. But for the first time ever on the Fox musical comedy, the actress will perform an original song written by one of her castmates.

At Friday's farewell PaleyFest panel for the series, which ends next Friday (8/7c, Fox), Michele revealed that Rachel Berry's last performance will be an entirely new song called "This Time," written by her longtime co-star Darren Criss. "I tailored it for her. I tailored it for the show and I didn't think it would happen," Criss said. "I tried to encapsulate all these past years into one song whether from Rachel's perspective, from the actors themselves, their perspective, and most importantly the fans' perspective."

The best and worst Glee performances ever

Criss was the first to admit it was no easy task fitting so much into a song, but he called it a "privilege" for Glee's longtime leading lady. "I want it to resonate with as many people as possible," Criss added. "[I wanted to] write a song about thanking them for the time we've had and also really looking forward to the future and bringing that time we had together into the future."

Michele praised Criss' original work as well, saying on the panel that it "perfectly encapsulated" her experience on the show. "Darren, honestly, gave me the greatest gift," Michele said. "It's so special. It was the most amazing memory, honestly, and you guys will love it."

Michele's last song as Rachel Berry will be especially bittersweet because it will be the actress' last performance on TV for a long time. "To give my voice a break, no singing on TV anymore," she said. Instead, Michele is resting up her vocal chords so that she can head into the studio next month to work on her sophomore album, which she described as a return to "my more standard kind of background."

But she won't be away from the small screen for long. Michele will next star on Glee co-creator Ryan Murphy's new Fox series Scream Queens, which will debut in the fall. "You will not recognize me or Rachel or anybody," she said. "It is just a whole different story there."

Glee's two-hour series finale airs Friday at 8/7c on Fox.

VIDEO: Watch Sue's best burns against Schue on Glee