SPOILER ALERT: Do not read if you have not yet watched “Money for RENT,” the fifth episode of the first season of “Schooled.”

It only took a few episodes for “Schooled,” ABC and Adam F. Goldberg’s 1990s-set comedy centered on a high school music teacher to dedicate an episode to “Rent,” the 1996 Pulitzer Prize-winning musical that took a generation by storm. But if it was up to Goldberg, he would have done it even sooner.

“This was our fifth episode we shot, [but] I would have aired this one as No. 2 just because I love ‘Rent’ so much, but because they had that big ‘Rent’ musical they were doing [on Fox], we just had to wait until they were free and clear and done,” Goldberg tells Variety.

The episode, titled “Money for RENT,” saw Lainey Lewis (AJ Michalka) want to get students excited about musical theater in the same way it touched her. She ended up going out of pocket to get the rights to perform the hottest new musical around, but came up against challenges due to the school caring much more about sports and giving the football team preferential treatment, which almost shut down her play.

Goldberg said the idea for the episode actually came from his real-life drama teacher, playwright Susan Cinoman, who also co-wrote an episode of his 1980s-set family comedy “The Goldbergs” and is co-writing the finale with him.

“She told me how she was constantly trying to figure out ways to get people into those shows and had no money,” he says. “That’s really how the episode came about and because it’s set in the ’90s, I said, ‘We have to do ‘Rent,’ it’s my favorite ’90s musical.'”

Here, Goldberg talks with Variety about his own personal connection to “Rent,” how he chose what songs from the musical to include, and what his plans are for other big 1990s homages, such as “Saved by the Bell.”

You mine your actual life — and childhood home movies — for “The Goldbergs,” but how close to real life was “Money for RENT”? Did your high school drama teacher actually get to put on the play?

They did put it on, I would say maybe 2000 or around there, and I have the video from that. And that was going to be part of the tag, ultimately, but I decided to do the interviews [with my real teachers] instead.

The pieces of pop culture history you’ve brought into “The Goldbergs” over the years have been very personal for you. How true is that with “Schooled,” specifically looking at including “Rent”?

I was in college starting in ’95, and “Rent” was the only show I could see — because if you waited in line and camped out, you could try to get the lottery tickets. I ended up seeing it [about] eight times, and some of my best memories are waiting for “Rent.” Everything else was unaffordable; this was like $20, so I do have a particular fondness for that musical.

Did you have to jump through any additional hoops other than the usual song licensing due to the fact that Fox was working with Jonathan Larson’s family on their live televised version of the play?

We had to do the same stuff they did. We were both performing it. We had to go to Fox and say, “We’re also doing a ‘Rent’ thing and they’re cool with us using the songs,” and Fox just said, “Totally fine, just let our musical be first.”

“Seasons of Love” is the iconic song that even people who don’t know the musical know, but what made you also want to include “What You Own” as opposed to a female-centric number that could have shown off AJ’s vocal range?

I’m so in love with “Rent” that I wanted to write this episode, which was never really the plan — that I was going to be writing a bunch of “Schooled” episodes. But it was just so new and bright and I love my teachers so much, that I was always drawn over there, and I was incredibly involved with the writing aspect of the show and breaking all of the stories. … So I scripted that entire sequence — the “What You Own” sequence — because you have a football player who’s quitting football to go be in “Rent” and I really scripted it to hit that moment where they say “I quit” in the musical. It matches perfectly. And it’s a duet, and I just had this vision for it. I scripted out every little detail and everyone thought I was insane. And some of the writers said, “I don’t know, we’re doing a whole musical sequence here, I think it will be really odd,” but I just said, “I think it will be really fun and funny.” And I was really happy with it; I love that scene.

Since Lainey is a music teacher, it really does keep the door open for more of these big numbers. Is that the evolution you’re taking?

AJ was a Disney pop star and she’s so talented, so this year we do Alanis Morissette; we do a whole Spice Girls number. So in the same way I have Hayley [Orrantia on “The Goldbergs”], who we found on “The X Factor,” [I] have someone so talented as your lead, singing. “Goldbergs” and “Schooled,” I just want them to make people happy. That’s really my only goal. They’re supposed to be written with joy and not jaded in any way and frankly, I just want parents to have something to watch with their kids. … And when you’re in the ’90s there’s such great music. We do a whole Smash Mouth episode where we dissect their song “All Star.” We have a really great opportunity to just explore ’90s music, which is terrible — and some of those terrible songs are awesome now, so it’s a lot of fun.

And here you had AJ singing “Seasons of Love,” so what is the plan with the songs you’re recording? Do you plan to release them ala “The Goldbergs” soundtrack?

“The Wonder Years” very famously got in a jam because they had all this amazing music and they didn’t fully license it so it could never go into reruns, and they only recently figured that out, so these two shows make the studios very nervous because they’re very expensive, and we have to get full rights to play the song over and over in syndication, hopefully. So it costs a lot of money and it’s why I do prefer to have either Hayley sing in “The Goldbergs” or AJ sing in “Schooled” — because you only have to pay half-price. I’m not paying Alanis Morissette when AJ sings it; AJ’s the performer and we’re only paying for the rights. So that helps my budget a lot. But we released “The Goldbergs” album and it did well, but the thing is that people don’t even really download songs anymore, so I think we broke even because it cost money to get everyone in and perform the songs. But the days of “Glee” doing a song and then they release it on iTunes and it’s a hit, I don’t really think people are buying music that way anymore, which is crazy!

Another iconic piece of 1990s pop culture is “Saved by the Bell.” Are you doing anything with that?

Not this season. It came up so much and the episode that just aired [“I, Mellor”], the whole point of that episode was this is a kid who’s acting like Zack Morris and C.B. [Brett Dier] figures it out. [But] I just said, “You know what? For me ‘Saved by the Bell’ is such a big thing, I want to do a whole episode.” And I have home movies that I made where I was recreating “Saved by the Bell.” I was obsessed.

Do you find you still pull the most specific stories from your life for “The Goldbergs”? What is the balance like for what you parse where?

The truth is that Barry’s graduating at the end of this year [of “The Goldbergs”], and Erica and Barry are going to college together next year. That’s what happened to my two siblings — they ended up going to the same college, and it was so problematic because they did not get along. There’s amazing stories there! And Adam is going to be the only one left in high school. So the show, just like how I grew up, is growing up in a different way. The high school episodes, I’ve kind of done them all on “The Goldbergs.” But I wanted to do something about designated drivers, and I thought it just worked better in “Schooled.” I just have to make sure we’re not doing the same exact thing on both.

How do you feel about more characters from “The Goldbergs” popping up on “Schooled” to glimpse what slightly older versions of them look like?

Now that I have a show in the ’90s, I get to show characters grown up. Everyone wanted Barry and Lainey to get married, but they were kids; it just can’t happen. But now I have a whole new decade where they’re adults. So the finale is called “Dr. Barry.” We’ve seen Barry Goldberg for six seasons as a teenager, what is it like when my brother is a doctor? How has he changed; how has he grown up; how is he the same? … We’re doing a reunion episode where Erica comes back and I showed what happens to a bunch of “Goldbergs” characters. It’s just a really fun, wild way to show characters on one show as teenagers and on the other show we get to see them as adults. And frankly, they are adults now: Sean [Giambrone, who plays Adam] is 19! … This is the age they should be now, in the ’90s, so it works, and I think it’s an amazing opportunity to set a show right afterwards where I can bring in one of the characters, and I’m making little comments and shout-outs because I always wanted it to play as one seamless hour.

On a broader level, how do you approach writing dialogue that is true for how people spoke in the time periods of your show when certain terms have become outdated and sensibilities have changed?

We did a sex-ed episode, and I never said the word “sex.” For me it’s really not about the ’90s or the ’80s and how people talked back then. The only thing I really care about is I want parents to watch this with their kids and not have to answer questions. So that’s really why in “The Goldbergs” we have the quote-unquote talk episode and I did with Fraggles. “The Goldbergs” is the No. 1 co-viewed show of parents and kids, and I have such wonderful memories of watching “The Wonder Years” with my parents and it was so impactful for me to have a show that they loved and I related to because I was the same age as Kevin Arnold, while they loved the nostalgia of it, and that’s just what I’m trying to do here. So that’s really the most important thing for me, and that’s why I tackle things sensitively. And by the way, the first 10 episodes of “The Goldbergs,” it’s a completely different show. I had a whole episode about scrambled porn — I would never do that now. I developed it for Fox and it was really a different show, and it wasn’t until Episode 7 or 8 where I was like, “Oh this actually shouldn’t be an expose of my crazy family,” it should be, “I relate to this. This is my family, too.” I shifted the tone, and that’s when the show started working. So I went in on this one knowing that it had to be softer and gentler. Every show about teachers, when you’re a comedy writer, immediately you want the teachers to be funny and that means they have to be jaded, mean, not want to be there, smoking in the teachers’ lounge. I love “AP Bio,” I think it’s so funny, it’s just not the show I want to do. I want to do a show where teachers are heroes and Lainey quickly discovers how much she can get from inspiring kids because my teachers were my heroes. … I had crazy parents, I looked to my teachers to raise me, and they did.

“Schooled” airs on Wednesdays at 8:30 p.m. on ABC.