I have a part of a server script that is meant to go into a players PlayerGui when they join, delete a certain GUI. It is then meant get a random player from the server, and clone their gui into that players gui but it can’t find PlayerGui in the player. Just get the infinite yield error for WaitForChild. Anyone know why?
local Copy = randomPlayer:WaitForChild("PlayerGui"):WaitForChild("Menu"):Clone()
Copy.Parent = player:WaitForChild("PlayerGui")
I have a team creation/selection ui, not really sure the best way to do it, tried 3 other methods and what I’m doing is the only one which allows everything to work, the server script isn’t actually changing the ui, it’s just doing commanding what happens and sending remote events to the local script that changes the ui. I thought that maybe it was saying that because maybe the PlayerGui just hadn’t been loaded by the time it checks so I delayed it and still got it.
That’s just the function that is supposed to update the new players gui, didn’t really think it was necessary to include the entire script seeing that the rest of the script doesn’t interact with that function at all.
Just store whatever edits players have made in ReplicatedStorage, and apply them whenever someone gets picked. Or, have a localscript clone the UI from ReplicatedStorage and put it under the LocalPlayer when the player gets picked.