Armed security in the schools.
Not really. There was armed security in the school. The officer apparently engaged the shooter, getting hit himself in the process which prevented further carnage.
But in this kind of attack the murderer has the initial advantage, and before the security team can respond lives may be lost even when armed security is present.
Of course screening at an entry point could have protected students in the school, but the screening point itself could become the target, or the killer could choose to launch his attack elsewhere.
Armed security is a great idea everywhere, but nobody should expect security teams to stop every attack. Determined attackers can penetrate even highly secured situations.