(Does not apply to Green Card holders)
Reference: Types of Visas
These instructions are valid both for legally buying a gun, and for getting a handgun license. Note: in order to get the handgun license, you have to already know how to load and shoot a pistol, and be prepared to take a shooting Proficiency test to prove it.
If you do not know how to shoot, register for "Learn to Shoot" first.
If you have a valid visa, have been in Texas for more than 3 months, have a Social Security number, and can read English sufficiently to take a written test over firearms law:
After successful completion of that class, you will need to submit the following documents to DPS in Austin:
Submit all documents to DPS by mail or upload, and wait. It takes several weeks.