How do I. Set the parent of a Screen GUI to player gui?
You can put the Screen GUI it in the StarterGui folder and it will automatically put that screenGui in every player’s playerGui folder.
You can use:
GUI.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
Just make sure you’re using a local script when using this method.
I did
script.Parent = game.Players.LocalPlayer:WaitForChild(“PlayerGui”)
script:Destroy()
Its in a local script in the ScreenGui. When I test in Studio, the local script didn’t destroy, and the screengui is not in my PlayerGui
Just put your GUI in StarterGUI. That should do it without requiring scripting.
Its for a product I am selling, and I don’t want to make the customer have to do anything, so Im making it all automated.
Ah, I think I get the problem. You are not parenting the UI to the playergui, instead, you are parenting the script to the playergui, so:
script.Parent.Parent = game.Players.LocalPlayer:WaitForChild(“PlayerGui”)
script:Destroy()
Should work
Oh wow, didn’t see that. Nice eye.
It still doesn’t work. Im not sure why.
Make sure the thing you are parenting to the playergui is a screengui, or else it won’t work
It is though, so… (30 characters)
May you show a video of you playtesting? Any errors? The only other solution is that, local scripts can only run in these locations:
ReplicatedFirst
ReplicatedStorage(not sure about this one)
startergui
Character
Tools
If any of the local scripts are not in these locations, then it wont run. If they are not in these locations, put it in one of these. The workspace cannot run local scripts.
Not workspace? Im running it in Workspace.
That’s why. You should run it in StarterGui.
Is there a way I can do it with a Server Script?
When dealing with player/screen gui’s it is preferable you use a local script =.
Even just to change the location?
Yes, unless working with a gui that renders in workspace, such as SurfaceGui or BillboardGui.