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

How to access playergui in a server event?

Problem, It's not accessing the player/playergui

This is a regular script in the worksapce

script.ActivateRespawn.OnServerEvent:connect(function(player)
	print(34134) -- Only thing that is printed
player.PlayerGui:WaitForChild('ActivateRespawn').Disabled = false
wait(.5)
player.PlayerGui:WaitForChild('ActivateRespawn').Disabled = true
	print(34134)

end)

2 comments

0

Seems like the child is never found, does 'ActivateRespawn' exist (with that exact spelling) in the PlayerGui?

0

yes

1 answer

✓ Accepted answer

FilteringEnabled

The client actually does the cloning of all the GUI elements from StarterGui into the PlayerGui. You might find this counterintuitive, and you might think that the server should do it, but it won't. As a result, the elements in the PlayerGui are never replicated to the server.

On that note, it's bad practice to be manipulating GUI elements on the server anyway; Just tell the client to do it.

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