The code I have is
function Clicked(Plr) if script.Parent.Parent.monitor.screen.SurfaceGui.login.Visible == true then Plr.PlayerGui.deskone.login.Visible=true else Plr.PlayerGui.deskone.welcome.Visible=true end end script.Parent.ClickDetector.MouseClick:connect(Clicked)
I want to make it so when the player clicks the part it makes the ScreenGui in the PlayerGui folder visible however when I play the game it gives me the error that 'deskone is not a valid member of PlayerGui' when in my player folder it has PlayerGui.deskone when looking at the workspace.
Thanks for any help.
That's because the guis in your PlayerGui
are not replicated to the server.
You need to either clone the gui into their PlayerGui
(with Visible
already set to true
) from the server script when they click the button, or use RemoteEvent
s to tell the client to show the gui. If you want it more secure, go for the first option.