Matt Damon, Robin Williams, Ben Affleck Matt Damon, Robin Williams, Ben Affleck

Ben Affleck, who co-wrote one of Robin Williams' most revered films, Good Will Hunting, has spoken out following the actor's tragic death, thanking the beloved star for "everything."

VIDEO: Relive Robin Williams' perfect Oscar acceptance speech

On Tuesday morning, Affleck posted on Facebook:

Williams, who committed suicide Monday, won Best Supporting Actor in 1998 for his portrayal of therapist Dr. Sean Maguire in Good Will Hunting. Affleck and Matt Damon co-wrote and starred in the film, earning themselves the Academy Award for Best Original Screenplay.

Hollywood remembers Robin Williams

In Boston magazine's oral history of the film last year, Damon and Affleck credited Williams for getting the film made. According to the lifelong friends, Harvey Weinstein green-lit the film after Williams signed on. "I think he was buoyed by [Damon getting cast in The Rainmaker]," Affleck said, "but Robin really was the rainmaker."

If you or someone you know needs help, please call the National Suicide Prevention Lifeline at 1-800-273-TALK (8255)