The gun was found through the school's weapon detection system.