The California example doesn’t quite work, because you can effortlessly bring a gun in from a neighboring state. So the legislation is much less effective than a national law would be.
Moreover, so much gun violence has proved to be opportunistic. Someone goes into a rage and because a gun is conveniently at hand, they can do an awful lot of damage. If a gun killing had to be premeditated and planned, as in many other countries, it’s a significant obstacle to such crimes.
https://www.slashfilm.com/1335445/bleak-streaming-future-suggests-world-without-cult-classics/