Mrs Doubtfire child star Matthew Lawrence says he stayed away from drugs after he was warned off them by Robin Williams.
Matthew, 42, who played Robin's son in the 90s film, said the actor opened up to him about his cocaine addiction.
The actor, who played Chris Hillard, told People that Robin gave him the "gift" of the important advice.
He told Matthew "don't ever do drugs, especially cocaine".
“He was very serious. He was like, ‘You know when you come to my trailer and you see me like that?’
“He’s like, ‘That’s the reason why. And now I’m fighting for the rest of my life because I spent 10 years doing something very stupid every day. Do not do it.’ I stayed away from it because of him.”
Mara Wilson, who played Natalie Hillard in the film, echoed Matthew's sentiment on Robin.
She said that he would "talk a lot about his issues with mental health and addiction", adding that she had a "lifetime" of struggling against anxiety and depression.
Mara, who is now 34, said that it was the first time someone had sat down and discussed her feelings.
She said how he told her that she wasn't some "weirdo freak" that was going to be rejected, and that she "wasn't alone".
Robin died when he was 63 in 2014 after he took his own life after being diagnosed with Lewy Body Dementia, which affects thinking, movement, behaviour and mood.
The comedian who was known for his quick wit and feel-good films spent his final months consumed by anxiety, paranoia, panic attacks and insomnia as the condition rapidly took hold.
The day before he took his own life, he told his wife Susan Schneider Williams "goodnight my love".
Susan tragically only discovered her husband's diagnosis after his post-mortem, and professionals said it was one of the worst cases they had ever seen.
She contacted filmmaker Tylor Norwood and asked him to raise awareness of what happened to her husband, which he did and he titled the documentary Robin's Wish.
"Robin Williams was in my life from like eight years old and the movies that he made followed me at points in my life that were important to me," he says.
"I think millions and millions of people had that experience with him. So when one of these [celebrities] pass in a way that's jarring, that can be really disturbing.
"The reason this film needed to get made was because Robin deserved better, as a human who gave so much to us all, the idea that when he passed the real tragedy of his life is that he didn't have an answer to what happened to him up until the end. He never got to know what this thing was."
Many speculated that he had taken his own life due to his struggles with mental health, but in actual fact he wanted to spare himself any further pain from the aggressive form of dementia.
"The things that people grasp were just that - they were just grasping at things that didn't have any weight to them or reality to them," Norwood says. "
So when the autopsy showed that he had Lewy body dementia to an extent that doctors really hadn't seen before - and that's to do with the fact that Robin was a genius and his brain was so good and so strong that it actually lasted much longer than theoretically you or I would have - that's a very different story."