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

Script fired by a remote event can't find a child of PlayerGui ?

Hello guys, So I am trying to do something like this

script.Parent.GetButtonRemoteEvent.OnServerEvent:Connect(function(plr, test)
	local gui = game.Lighting.Folder.TestButton:Clone()
	gui.Parent = plr.PlayerGui.TestFrames.Frame.ScrollingFrame
	gui.Test.Value = true
end)

It says "TestFrames is not a valid member of PlayerGui" when it actually is. It is in PlayerGui but for some reason it can't find it.

Please, help

2 comments

0

Don't use lighting as storage. And use a remote event on the client, not the server.

0

Listen for the event OnClientEvent from the client , and fire from the server

1 answer

✓ Accepted answer

You are trying to access the ScreenGui from a server script. ScreenGuis cloned from StarterGui to PlayerGui are not replicated to the server, therefor you cannot use them from a server script.

You need to either use RemoteEvents to tell the client when to modify the gui or clone the gui from a server script into the PlayerGui, then it will be accessible by server, although it's a less recommended way.

(Note this answer is a copy/paste of my other answer, because I've already typed the same thing at least 4 times this week and I have no idea how to reword it anymore to make it not look the same xd)

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