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

How do I Make a GUI Button That Holds the LeftShift Key?

Asked by 2 years ago

I added a sprint feature in my game that works if you hold left shift and when you let go the sprinting stops. Since this is not possible on mobile, how can I add a gui button that holds the left shift key if you press it and it stops holding it if you press it again vice-versa? If you have a solution, please tell me where to put the script in - the button gui's screengui or the button gui itself?

1 answer

Log in to vote
0
Answered by
KingDomas 153
2 years ago
Edited 2 years ago

Taken from the dev forum. I don't think it's possible to hold the shift key directly, but you could run the function that makes you sprint when you press the button:

You can’t really force a key press, seeming as a key press is done by a user - as such its their choice if they press the key.

What you can do however is: Act like they have pressed it, without pressing it. This is simply done by calling the function / action itself.

Ad

Answer this question