Here's an idea.
If you want to keep a legal gun, you have to join the national guard or reserve. There is that sticky clause in the first part of the second amendment that gets ignored. Maybe have a one-time amnesty, where you can turn in your gun and get compensated for part of its cost.
It may sound harsh, but freeing the slaves was done without any compensation on the former owners. From an economic standpoint, it was one of the largest exportations of wealth in that didn't involve a revolution.
That represented a different turning, one where we collectively said that this was no longer a moral way to order society, I think we are at that same point with weapons that exist solely to kill in the most efficient way possible, No other machine has one use that we allow private citizens to hold but that one use is against the law.
Perhaps have some carve out for smaller-caliber single action rifles used for subsistence hunting, but the past week has been too much and federal action is needed.
Prayers don't stop bullets, nor do laws, but a large scale manufacturing industry can be curbed.