As you know there was a school shooting in America. It happens many times.
My solution would be to have very strong doors in the classrooms that lock centrally when an alarm has sounded. The doors would waste the shooters ammo and keep out bullets.
Another solution would be a smoke screen so the halls of the school would fill with smoke so the shooter can't see the victims.
The obvious solution would be to raise the age limit of ownership of guns. You would need to be over 25 before you can own hand gun and over 20 for a rifle. That way mental health problems would be exposed before they could get hold of a gun and grudges would dissipate before guns could be obtained.