Mobile jump button

How would I check if the player has pressed the mobile jump button and execute an action if they have held it down for like 1 second?

I know this exists Documentation - Roblox Creator Hub but it does not tell me if the player has stopped pressing the button, only if they have jumped.

2 Likes

I’m not entirely sure if you’re able to go about it by using UserInputService, I’ll take a look but why don’t you consider checking if the humanoid is jumping?

Example:

while Player.Character.Humanoid.Jump == true do

    print('Is jumping')

    wait()

end

Edit: fixed an issue

2 Likes

Well, A hacky method to do it is wait until the jump button appears under TouchGui in PlayerGui and use the MouseButton1Down/Up functions. (This is how I disabled the jump button in one of my games)

6 Likes

I’ve just tested this in studio using the Emulator and seems to work perfectly.

if game:GetService("UserInputService").TouchEnabled then
 	 game:GetService("UserInputService").JumpRequest:Connect(function()
 	     print("The player sent a jump request")
     end)
 end
6 Likes

I never said it doesn’t work, I can’t use it as it doesn’t tell me if the player is holding the button down or not.

On the other hand, @Stratiz your method works really well :grin: if anyone has got a better way to do this, let me know.

1 Like

Oh right, my bad.