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)

3 comments
Now that I think of it, wouldn't a remote function be better?
Remote functions are for two way communications. Remote events send a request, and remote functions send a request and wait for a response. Use remote functions if you want to return data. In your case, you’d want to return if the player is on a mobile device.
I used a remote function and it works. So the script fires the function and it checks if the player is on mobile. Then the info returns to the script and tells the script if the player is on mobile or not.