How To BindAction To The Mobile Jump Button

Is there a way to use the BindAction function to detect when the jump button is pressed on a mobile device?

The following code only detects jumps if using a keyboard or console, but not a mobile device:

game.ContextActionService:BindAction("Jump", JumpButtonAction, false, Enum.KeyCode.Space, Enum.KeyCode.ButtonX)

2 Likes

Have you tried this?

http://wiki.roblox.com/index.php?title=API:Class/UserInputService/JumpRequest

3 Likes

Can’t say I share that experience. Seems to work fine on mobile.

2 Likes

The JumpRequest is an event, so it does trigger as expected on mobile, but it does not allow me to unbind the actual jump. It triggers the event, and then the character still jumps. What I was looking to do was to unbind the jump, and replace it with my custom behavior.

2 Likes
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)

game:GetService("UserInputService").JumpRequest:connect(function()
	print("jumping")
end)

This one works on PC, unsure about mobile. Try it.

Interestingly enough for mobile it gets rid of the jump button entirely

I set the humanoid JumpPower = 0 and that did the trick.

1 Like

When I set the humanoid JumpPower = 0, it will not show the jump button on my mobile in emulation. How are you getting them to jump on mobile with it set to 0?

In my case, I wanted the jump disabled to prevent the player from accidentally exiting a vehicle seat by mistake.

1 Like

Please close this thread as your issue has been resolved.

1 Like

Sadly, it seems like “JumpRequest” doesn’t work when you replace the default character with a custom character.

3 Likes