It matters what the court thinks. As I recall, you have to be adjudicated mentally incompetent to lose your right to own a gun. But that could vary from state to state. In California they could "5150" you.
The concept of mental health is fungible. That makes it difficult to adjudicate. It also creates an opportunity for political oppression.
Psychiatry possesses an inherent capacity for abuse that is greater than in other areas of medicine.:65 The diagnosis of mental disease can give the state license to detain persons against their will and insist upon therapy both in the interest of the detainee and in the broader interests of society.:65 In addition, receiving a psychiatric diagnosis can in itself be regarded as oppressive. In a monolithic state, psychiatry can be used to bypass standard legal procedures for establishing guilt or innocence and allow political incarceration without the ordinary odium attaching to such political trials.
Now, that was the Soviet Union, one of the most repressive dictatorships in one of the most barbaric eras in human history, so the concept of political oppression through psychiatry is absurd, right? Thomas Eagleton ran into some difficulty because of allegations regarding his mental health. Running against a guy named Richard Nixon. Remember Daniel Ellsburg?
In August 1971, Krogh and Young met with G. Gordon Liddy and E. Howard Hunt in a basement office in the Old Executive Office Building. Hunt and Liddy recommended a "covert operation" to get a "mother lode" of information about Ellsberg's mental state in order to discredit him. Krogh and Young sent a memo to Ehrlichman seeking his approval for a "covert operation [to] be undertaken to examine all of the medical files still held by Ellsbergs psychiatrist." Ehrlichman approved under the condition that it be "done under your assurance that it is not traceable."
Given the realities of the George W. Bush administration and the even more disquieting reality that the Republican Party ran an outright fascist for president in the last election, the importance of properly adjudicating the rights of people in a court of law that depends on proper representation and the presentation of evidence to a judge should be obvious.
So, to answer your question whether or not you should be able to own a gun I would say I don't have a clue. Nor should I. It's none of my business. I think a court of law should make it my business. If you're having trouble, I would that you had a proper support network including friends, family, a functioning health care system and a culture that values something more than how much money it can make off you.