Metal detector stops student from allegedly bringing gun into school