Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is the mobile jump button referred as for UserInputService?

Hello,

I have a script that toggles flight when you double press space, but this doesn't work on mobile because they don't jump with a space bar. What is their jump button called in UserInputService?

Thank you!

1 answer

✓ Accepted answer

Not sure this is a thing, but you could detect if they are not a computer and jump.

local UIS = game:GetService("UserInputService")
function JumpRequest()
    if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled then -- if a player uses a touch screen, no keyboard, and no mouse then
    -- do stuff--
    end
end

UIS.JumpRequest:Connect(JumpRequest)

More information:

https://developer.roblox.com/en-us/api-reference/property/UserInputService/TouchEnabled

https://developer.roblox.com/en-us/api-reference/property/UserInputService/KeyboardEnabled

https://developer.roblox.com/en-us/api-reference/property/UserInputService/MouseEnabled

https://developer.roblox.com/en-us/api-reference/event/UserInputService/JumpRequest

6 comments

0

Error line 8; JumpRequest is not a proper function. Lol, lowercase j.

0

ahh, sorry!

0

ahh, sorry!

0

edited, lmao

0

This could work, thank you, but how do I check if they double jump?

0

That's not possible.

This discussion is preserved as it was. New answers, comments, and votes are closed.