A 12-year-old student is in protective custody after he brought a pellet gun to school, causing a lockdown.