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

Why won't my script recognise a Gui in my PlayerGui folder?

Asked by 5 years ago

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.

1 answer

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
5 years ago

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 RemoteEvents to tell the client to show the gui. If you want it more secure, go for the first option.

0
Thank you! PureGamerGames 16 — 5y
Ad

Answer this question