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

Any Alternates/Fixes For ContextActionService's GetButton Function?

Asked by
Hacreey 49
5 years ago

I'm using the GetButton function of ContextActionService to get a button. The issue is, for some reason I don't understand, is that the function yields until it finds the button. If you know how CAS works, you'll know the button won't exist on non-mobile devices which will then lead to the script yielding.

Basically, i'm getting the button using the GetButton function to then rescale it based on the user's screen size. If the user is for example on PC, the script will then yield.

  • How can I check for the button without the entire script yielding?
  • Is there any way to ACCURATELY detect a mobile device and if so, call the GetButton function.
  • If no possible way, should I just stick it inside a coroutine or spawn?

Answer this question