Robin Williams' talent, wealth, love of his family, friends, prestige, and the world's admiration did not prevent him from taking his own life. How could it be? It doesn't seem to make sense. But it appears though that Robin had a deepest need for something which he and nobody around him probably never knew about. I surmise that this huge unmet need is extremely internal rather than external.
To prevent suicide, such as in the severe case of Robin Williams, a person will need professional therapy and counseling. A psychotherapist or counselor must be able to form a relationship with the patient that revolves around more than or beyond the "problem." I say this because when a counselor is purely problem-focused, the problematic behavior is going to be reinforced. Counseling accomplished properly over enough span of time with spirituality-psychotherapy integration can build up the "whole person" to prevent suicide.
Let me say that it's impossible to ignore the fact that most suicide attempters and doers are from unstable or broken families. A lot of them come too from life experiences of trauma. Yes, they all have "a story." But oftentimes, it is not "the story." Unpacking "the story" and healing from it holds the key to preventing suicide.