What I wanted to do is enhance gameplay by adjusting the GUI for mobile users. For example, on PC or Tablet, you will have the full GUI, but on Phone, you have to press a button so you get the full GUI, otherwise, the only thing on your screen is the button for the full GUI. (For example, in MeepCity.) I don’t want to have that on PC and Tablet. Can someone show me an example on how to do this?
✓ ANSWER ACCEPTED
Detect if user is on mobile?
2 answers
✓ Accepted answer
You can't check if the user is on mobile, but there are workarounds.
You don't need to check if the player is on a phone to realize that phone's have small screens. You can use the camera's ViewportSize property to identify the size of the screen you are working with, and when it's under a certain size, change the GUI to be the open/close menu GUI. This is better than checking if a device is a phone because you never know if someone likes to play with a really tiny window on PC, or someone has a extremely large device screen :p
Hope this helps! :)
An easy way to do this is by using the code below in a localscript
local uis = game:GetService("UserInputService")
local ismobile = uis.TouchEnabled
if ismobile then
-- code
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
No, this is true if a user has a touch screen PC.
I have a touch screen laptop lol. this wouldn’t work 100% of the time
Unfortunately (whether touchscreen computers activate it or not), TouchEnabled still won't differentiate between mobile and tablet.
@1000 yes, 100% of the time. It means it still works sometimes.