Dryer WON't Heat

My gas maytag dryer doesn’t always heat. I replaced the ignitor worked a couple of times, then I replaced the gas sensor worked a few times. Now when I turn it on it may or may not light. I don’t know what else to replace. Does the high limit switch have anything to do with it lighting? Please can someone help?
thank you in advance for your help