I believe if you did the following things at all schools, we could prevent school shootings to almost never happen anymore.
The first thing would be a camera system that's monitored in one room by a police officer. The cop should also be carrying several nonlethal weapons. We should also get electrical door locks so that if we saw an intruder, we could lock all the classrooms. We should also get panic hardware where you can go outside but no one can come in unless you open the door for them.
This is what I think we should do to prevent school shootings.