I have a code that enables a UI if a player is playing on mobile but it’s not working.
local UIName = "PhoneShow"
local InputService = game:GetService("UserInputService")
game.Players.PlayerAdded:Connect(function(plr)
local isPhone = InputService.TouchEnabled
local isPc = InputService.MouseEnabled or InputService.KeyboardEnabled
if isPhone and not isPc then
plr:WaitForChild("PlayerGui"):WaitForChild(UIName).Enabled = true
else
print(isPhone)
print(InputService.KeyboardEnabled)
print(InputService.MouseEnabled)
end
end)
it prints
false true true
even if I join from a phone.
This Code is a servers script and is in serverscriptservice