I want to detect a mobile device and enable the custom mobile GUI. The code I have right now is not working as it displays the PC GUI every time I play on mobile.
local UIS = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled
and not UIS.GamepadEnabled and not GuiService:IsTenFootInterface() then
script.Parent.Enabled = true -- MobileGUI located in StarterGui
else
script.Parent.Parent.ZedsMarketPC.Enabled = true
end
Any help would be appreciated.

6 comments
I've used this code and added script.Parent.Enabled = true (for the MobileGUI) and script.Parent.Parent.PCGUI.Enabled = true but it still doesn't work?
It seems to always be enabling the PC GUI with no printed errors.
Try publishing it.
Also did you try printing/debugging it?
Weird - I tried printing and it's always printing 'The user's device does not have a touchscreen', even though I'm on mobile.
SOLVED. Had to enable GUI from PlayerGui instead of script.Parent.