Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Can I Sync Computer Buttons With Mobile?

Asked by 2 years ago

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!

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 MarkedTomato 810 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

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

Ad

Answer this question