Actor Matt Damon recently recalled being stunned by a memorable improvised line by Robin Williams while filming Good Will Hunting. Written by Damon with longtime friend and creative partner Ben Affleck, the 1997 comedy-drama stars Williams as psychology professor Dr. Sean Maguire who is tasked with providing therapy for the broken, yet extremely gifted Will Hunting (Damon). Earning rave reviews and over $225 million at the box office, Good Will Hunting proved a massive success for Damon and Affleck, leading them to their Academy Award win for Best Original Screenplay.

Speaking with Vanity Fair, Damon recalled being stunned by Williams’ improvised line in a pivotal Good Will Hunting scene.

After Maguire finally breaks through to Will, the young genius decides to follow his love to California. In a note left to the professor, Will uses Macguire’s previous words to punctuate the moment, “I had to go see about a girl.” The original scene intended for Macguire to stay silent. However, during one take, Williams decided to throw out an iconic response that made it into the final cut, “Son of a bitch. He stole my line.” Read what Damon said below:

Robin would open the door and come out, and he’d find this letter. I was right next to Gus, next to the camera…’cause we wanted it as if he was hearing my voice. I said, “Sean, if the professor calls about that job, tell him sorry, I had to go see about a girl.” So I would say that. And what was scripted was that he just takes a moment and realizes that I’m gone.

In true Robin fashion, we did 60 takes. Like we just left the camera rolling and he kept coming out, and kept coming out. He did something different every single time. I remember when he said, “Son of a bitch. He stole my line,” I grabbed Gus’ shoulders. I felt him tense up like we both knew. We were like, “Holy shit.” What a line. How did we not think of that?

Why Robin Williams Was Perfect For Good Will Hunting

Sean and Will sitting on the park bench in Good Will Hunting.

Williams began his career in the 1970s performing stand-up comedy in San Francisco. There, he honed his improvisational skills, a talent that proved vital when he transitioned to television by the end of the decade. Projects including Mork & Mindy, Popeye, and Good Morning Vietnam allowed Williams to showcase his ad-lib abilities with the latter leading him to a Golden Globe Award win for Best Actor in a Motion Picture.

At its core, Good Will Hunting is a grounded coming-of-age drama touching upon themes of trauma, romance, and grief. Damon and Affleck used comedy to build strong relationships between characters as well as to punctuate the film’s key moments. During a session where both Will and Macguire opened up about their personal lives, Williams completely went off-script and delivered an improvised story about his character’s wife farting in her sleep. The humorous scene resulted in one of the most heartfelt moments between Will and Macguire in Good Will Hunting, contributing to Williams’ Academy Award-winning performance.

Although the Flubber star is known for his loud bombastic comedy, Williams already showcased his dramatic capabilities in The World According to Garp, Dead Poets Society, and Being Human, among others. Good Will Hunting allowed Williams to blend his style of comedy with the dramatic roles he enjoyed during that era of his career, helping the film to become one of the best of the decade.