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

How to Access the PlayerGui?

Hi, just a simple question as I have been looking through Google and YouTube and have come up with nothing. How do you access the LocalPlayer's PlayerGui and change a ScreenGui's Parent to it (through a local script.)

1 answer

To set something's parent to the PlayerGui we would do the following:

local plr = game:GetService("Players").LocalPlayer --the local player
local playergui = plr:WaitForChild("PlayerGui") --The local player's PlayerGui


local screengui = Instance.new("ScreenGui") --our screengui object

local screengui.Parent = playergui --put our screengui into the PlayerGui

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