THE ONLY PART OF THE SCRIPT THAT IS BROKEN IS THE MOBILE CHECKER!
Basicly the script is supposed to open a gui. It works, but when I check for if the player is on mobile, it doesn't work. Any reason why? Thanks!
SCRIPT:
local RemoteEvent = game.ReplicatedStorage.Events.Shops script.Parent.Touched:connect(function(hit) if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then local ismobile = game:GetService('UserInputService').TouchEnabled --Issue. if ismobile == true then RemoteEvent.Shop2Event:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent)) else RemoteEvent.Shop1Event:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent)) end end end)
UserInputService
is client-side only. It does not exist on the server. You’ll have to use a RemoteFunction
checking if the user is on mobile. You shouldn’t use UserInputService.TouchEnabled
, as this is true
if a user has a touch-screen computer.