What is the code for this instance of ContextActionService:UnbindAction(...)?

Hey guys! Just wondering, how can I remove the Jump Button? (I have the code properly written, but I can’t figure out the UnbindAction() code to put in between the brackets. I’ve tried “Jump” and “JumpButton”, and neither of them work.)

Thanks!

You can check action names located under the “ActionBindings” tab in the developer console.

If you’re referring to the default jump bind, you should put “jumpAction” as the argument.

Thanks, I’ll try this. :slight_smile:

Hey again. So after testing, it didn’t work.

Here’s my code, if you could take a second and go over it. Thanks!

game:GetService("ContextActionService"):UnbindAction("jumpAction")

What I usually do to disable the Jump action is by disabling the Jump state of the humanoid. This also hides the jump button for touch screen devices. You can find more information about humanoid states here and a list of humanoid states can be found here.

Character_Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
3 Likes

Didn’t work. I can still see the button. Is it just my game?

I forgot to mention that the code must be ran using a local script.

Done. I have it in a LocalScript, inside StarterGui.

May you provide the code that you have implemented for further analysis?

Well, I’m a dummy!

I forgot to add a wait() line haha. It wasn’t getting the character, since it hadn’t loaded yet.

Thanks! Yours was marked as the solution.

1 Like

Additional Information

A common method for getting the player’s character would be:

local Players_Service = game:GetService("Players") --gets Players service
local Player = Players_Service.LocalPlayer --gets local player
local Character = Player.Character or Player.CharacterAdded:Wait() --checks if the character has loaded else will wait for the CharacterAdded event to fire returning the player's character object
Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)

Note

It is important that Player.Character comes first before Player.CharacterAdded:Wait() to avoid unexpected errors.

There will be a new implementation of the character loading sequence, however I am not sure if this will impact the method I have provided.

2 Likes