PlayerGui
A player’s on-screen UI. Only that player receives what’s inside.
- Inherits: Instance
- Creatable: No. The server creates one for each player who joins.
- Replication: Replicated only to its own player.
The server gives each player a PlayerGui when they join and fills it with copies of what’s in StarterGui. It’s drawn on that player’s screen: every ScreenGui directly inside it, with the GUI objects inside those. It isn’t reset when the player’s character respawns.
Client scripts usually change the UI here; those changes stay on that device. The server can change a player’s PlayerGui too, and only that player receives it.
Properties
Section titled “Properties”Inherited from Instance: name, archivable, id, className, parent, destroyed
Methods
Section titled “Methods”Inherited from Instance: getPropertyChangedSignal, setAttribute, getAttribute, getAttributes, getAttributeChangedSignal, getChildren, getDescendants, findFirstChild, findFirstChildOfClass, findFirstChildWhichIsA, findFirstAncestor, findFirstAncestorWhichIsA, waitForChild, isA, isDescendantOf, isAncestorOf, getFullName, clearAllChildren, destroy, clone, toString
Events
Section titled “Events”Inherited from Instance: changed, childAdded, childRemoved, descendantAdded, descendantRemoving, ancestryChanged, destroying, attributeChanged
Examples
Section titled “Examples”Find your UI from a LocalScript
Section titled “Find your UI from a LocalScript”import { PlayerGui, ScreenGui, TextLabel, task, waitForChild, waitForLocalPlayer } from '@rally/sdk';
task.spawn(async () => { const me = await waitForLocalPlayer(); const gui = await waitForChild(me, 'PlayerGui', PlayerGui); const hud = await waitForChild(gui, 'HUD', ScreenGui); const title = await waitForChild(hud, 'Title', TextLabel); title.text = `Welcome, ${me.displayName}!`;});