I’m creating a restaurant game. When you click the menu, which is a part in workspace, it should open up a UI frame that has some buttons on it. They are connected by two remote events, one for making the menu visible, and one for making it invisible.
Everything works perfectly on PC, but the UI does not show up on mobile. I playtested with my friends and found clicking works on mobile, but the UI shows up on my screen and not their mobile screens.
Im confused because
- I’m using local player in a local script, and referring to PlayerGUI not StarterGUI, why would their menu show up for me?
- Why won’t UI show up on mobile?
Here is the Code, I’m a begginner lol:
--this is a local script
local player = game.Players.LocalPlayer
local menuUI = player.PlayerGui.ScreenGUI.Menu
menuUI.Visible= false
game.ReplicatedStorage.MenuOpen.OnClientEvent:Connect(function()
menuUI.Visible = true
end)
game.ReplicatedStorage.MenuClose.OnClientEvent:Connect(function()
menuUI.Visible = false
end)
And here is the server side script
--this is a server script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Menuboard = script.parent
local ClickDetector = Menuboard.ClickDetector
local OpenRemoteEvent = ReplicatedStorage:FindFirstChild("MenuOpen")
local CloseRemoteEvent = ReplicatedStorage:FindFirstChild("MenuClose")
--reopening
local clickcount = 0
ClickDetector.MouseClick:Connect(function()
if clickcount ==0 then
print("Menu clicked")
OpenRemoteEvent:FireAllClients()
clickcount = clickcount + 1
else
CloseRemoteEvent:FireAllClients()
clickcount = clickcount - 1
end
end)
I’ve tested different variations so many times, please tell me if you have any ideas.
I’ve tested different variations so many times, please tell me if you have any ideas.
If the error is in the localscript, it might be that when I listened to the event, I didn’t pass any variables in the function()? I’m not quite sure how passing variables work.
Clorp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.