Teacher has her back to the class writing on the blackboard. Shooter comes in and opens fire, teacher dead on the floor, students running and being shot.
Teacher is in front of class lecturing, shooter comes in and starts friring, teacher is dead before she gets to her desk.
Teacher is in the middle of the classroom talking to a student, shooter walks in and opens fire. Teacher never makes it back to their desk.
Even if the teacher has the gun on them, chances are they will never get the opportunity to use it. And if they do, say if they weren't hit first (teachers are often the only one standing), by the time they realized what was happening, got the gun out, took off the safety, students would be running everywhere, the chances that they wouldn't hit a student in the confusion would be pretty low.
Please explain how the gun helped the teacher. Do you think the teacher is going to walk around with a gun in their hand ready to shoot?