I'm trying to make a script which shows the player a GUI message depending on whether TouchEnabled is Enabled or Disabled. I've found that if I click 'Play' while in Studio it will work correctly whereas if I load my game on my phone, it does not.
local ServerStorage = game:GetService("ServerStorage")
local Hum = script.Parent
local player = game.Players:GetPlayerFromCharacter(Hum)
local PlayerGUIs = player:WaitForChild("PlayerGui")
local UIS = game:GetService("UserInputService")
if UIS.TouchEnabled then
ServerStorage:FindFirstChild("PossiblyMobile"):Clone().Parent = PlayerGUIs
print("Possibly Mobile")
else
ServerStorage:FindFirstChild("PossiblyNotMobile"):Clone().Parent = PlayerGUIs
print("Possibly Not Mobile")
end
Any idea why it isn't working?

2 comments
Is this a local or server script? Because your code is undoubtedly wrong.
It’s in a server script located inside ServerScriptService