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

How Can I Sync Computer Buttons With Mobile?

Hello there,

I have a stamina-based sprint script in my game which only works for pc using ctrl. I was wondering if anyone could tell me how to add a mobile only button that holds ctrl and you can tap to enable it and disable it. I would rather have a circle-button like jump on mobile than a screengui.

Thanks!

1 comment

0

I think ContextActionService might be useful for this case since you can make a touch button for mobile players and plus you don't need to detect if they have a touch screen Roblox does it automatically for you. https://developer.roblox.com/en-us/api-reference/class/ContextActionService

1 answer

✓ Accepted answer

You can do this by making a script that causes the the gui to only appear for mobile users from using this code in a local script (you can modify this to your liking) youre able to add th rest of the code for making your character sprint BUT you have to change the function of userinputservice into mousebutton1click

local UserInputService = game:GetService("UserInputService") local ismobile = uis.TouchEnabled

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