First of all, everyone has to provide references that will be called before you are given a gun. In most cases, someone around the shooter knows of violent tendencies. Secondly, everyone who wants a gun gets a psychiatric evaluation. Short of that, there is a national database that law enforcement and mental health professionals can enter red flags into. Those with red flags in the system have to take psychiatric evaluations before they are given a deadly weapon.
Mentally Ill People Should Not Have Guns: Here’s An Idea On How To Fix That