It's illegal to sell a long gun to anyone under 18.
It's illegal to sell a handgun to anyone under 21.
3. Minors can (sometimes) possess guns
There is no minimum age to possess a gun in Texas. So while a 17 -- or 15, or 12-year old -- can't buy a gun, they can legally be given a gun by an adult. If they have parental permission.
As Charles C. W. Cooke explains in the National Review, "While there is no minimum age to possess firearms in Texas, it remains illegal in the state for to sell, lease, rent, or give a firearm to a person under 18 years of age without a parent’s permission."
Still, there's a catch...
4. Adults are criminally liable for gun activity by minors
The Texas penal code holds adults responsible if a minor gains access to a "readily dischargeable firearm" (i.e. one that is loaded) and fires it. The penalties are even stiffer if a person is shot by the minor.
This means that adults can be held liable for something like a school shooting by a minor if it can be proven that they were criminally negligent with regard to that minor's access to weapons.
The laws here are nuanced, but there is a chance an adult might be held at least partially responsible for today's events, along with the shooter.
5. Students may not carry firearms at Santa Fe ISD schools
The school district where the shooting occurred doesn't let students carry firearms, replica guns, BB guns, and the like on campus.
The District Code Of Conduct notes: "Mandatory expulsion under the federal Gun Free Schools Act does not apply to a firearm that is lawfully stored inside a locked vehicle, or to firearms used in activities approved and authorized by the district when the district has adopted appropriate safeguards to ensure student safety."