I am honestly writing for a friend of mine. Her gas dryer ( not to old ) will not heat. She said everything else works on it.
Not uncommon the gas valve (solenoid) goes bad. Could also be a thermal fuse blown due to overheating, typically caused by exhaust obstructions. Citing brand and model when asking appliance questions is always advised, so responders can look up service info.
It is important to keep your lint exhaust clean. At least every 6 months, take off the tubing, and vacuum it out. If you have a 'pipe' that lifts the exhaust to the roof (instead of straight out to an outdoor vent), it (outdoor roof exhaust pipe) should be professionally cleaned no less than once a year.