Xbox buttons are not responsive in game

Hi yall i would like to ask how should make this lines of code better for the game?
The index 0 is the green button A on the Xbox controller. But for some weird reason, i could not apply this very well during the game. Is there another way to make it more responsive?

If u pressed 10 times, there could be only 5 or 6 executed
And btw, this sensor is on “All events” and no tap mode, so i have to use the “.triggered”
Thanks yall


but = c.sensors["xbox-but"]




if but.triggered or "jump" in key:
    buttons =  but.getButtonActiveList()   
    if but.positive:            
        if 0 in buttons:
            print ( "jump")           
    else:        
        o["button"] = "  "