When unbinding “jumpAction” through ContextActionService, your character will lose the ability to jump. This is desired.
However if you press A on your gamepad, it will rebind this action and force your character to jump. This makes it impossible for the developer to override the button.
Repro:
Run this code in command line or a local script:
Press spacebar (notice you don’t jump)
Press A on your gamepad (notice jump happens)
Checking Developer Console for “Action Bindings” shows it reappears.
When playtesting in Studio, go under your Local Player > Player Scripts. You should find a module script named PlayerModule
Copy it, then exit playtesting and paste it into Starter Player > Starter Player Scripts
After that, go into the copied PlayerModule > ControlModule > Gamepad. Opening the Gamepad script and scrolling down to the end of the Gamepad:BindContextActions() function should bring up a line where the jumpAction is binded.
The reason you’re seeing jump happing again is because you’re switching from mouse input to gamepad input. When that change happens, the actions are bound again. To get around this you can listen to UserInputService and unbind the jump action when the input type changes to gamepad, unbind the action. This local script should do the trick.
local userInputService = game.UserInputService
userInputService.LastInputTypeChanged:Connect(function(lastInputType)
if (lastInputType == Enum.UserInputType.Gamepad1) then
game:GetService("ContextActionService"):UnbindAction("jumpAction")
end
end)