How to disable gamepad buttons and re-enable them?


I need help with gamepad controls. I’m trying to make it so when a player, who uses gamepad, opens up a GUI, it will disable certain controls.

For example, let’s say the A button is to jump, and then they open a GUI, how do I have it so A is to now select, and no longer jump?

And this works the same way around, so when they close the GUI, the A button becomes jump and no longer select.

How do I do this? Any help will be appreciated.