Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

1 comment

0

Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.