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

Mobile support not working as intended?

Asked by 5 years ago
Edited 5 years ago

I'm trying to make mobile support in the form of a gui, but this script doesn't work.

local Players = game:GetService("Players")

function onPlayerAdded(player)
     if game:GetService('UserInputService').TouchEnabled then
    script.Parent.Frame.Visible = true
else
    script.Parent.Frame.Visible = false
end
end

Players.PlayerAdded:connect(onPlayerAdded)

Thanks for any help!

0
UserInputService is localscript only. User#19524 175 — 5y
0
Its already a local script awad6314 9 — 5y
0
PlayerAdded won't work for the player running the LocalScript. It will instead wait for a new player. Use LocalPlayer instead. User#19524 175 — 5y

Answer this question