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

How to access playergui in a server event?

Asked by 8 years ago

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)
0
Seems like the child is never found, does 'ActivateRespawn' exist (with that exact spelling) in the PlayerGui? BlackJPI 2658 — 8y
0
yes NetworkMan243 65 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

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.

Ad

Answer this question