Skip to content

Class · inherits BasePlayerGui

PlayerGui

Official docs ↗

A container that holds a player's UI.

About PlayerGui

The PlayerGui container stores objects that create the player's GUI. If a ScreenGui is a descendant of PlayerGui, any GuiObject inside that ScreenGui displays on the player's screen. Any LocalScript will also run if it is inserted into a PlayerGui.

When a player first joins the experience, their PlayerGui is automatically inserted into their Player object. When the player's Player.Character spawns for the first time, all of the contents of StarterGui are automatically copied into the player's PlayerGui. If StarterGui.ResetPlayerGuiOnSpawn is set to true, all the contents of a player's PlayerGui are cleared and replaced with the contents of StarterGui every time the player's character respawns.

Note that if Players.CharacterAutoLoads is set to false, the character won't spawn and StarterGui contents won't copy over until Player.LoadCharacterAsync is called.

If you need to control a player's UI container during playtime, for example to show/hide a specific ScreenGui or any of its children, access it as follows from a LocalScript:

Properties 3

  • CurrentScreenOrientation: ScreenOrientationReadOnlyNotReplicatedDescribes the player's current screen orientation.

    Describes the player's current screen orientation as an ScreenOrientation value. Unlike the writable PlayerGui.ScreenOrientation property, which requests a preferred orientation mode, PlayerGui.CurrentScreenOrientation is read-only and reports the orientation the device is actually displaying, updating as the player physically rotates a mobile device.

  • ScreenOrientation: ScreenOrientationSets the preferred screen orientation mode for this player, if on a mobile device.

    Sets the preferred screen orientation mode for this player when on a mobile device, expressed as an ScreenOrientation value. Changing it requests that the device lock to, or follow, a particular orientation (for example Portrait or LandscapeSensor). The orientation the device is actually displaying is reported separately by the read-only PlayerGui.CurrentScreenOrientation property. This property defaults to LandscapeSensor.

  • SelectionImageObject: GuiObjectOverrides the default selection adornment used for gamepads.

    Overrides the default selection adornment used for gamepads. For best results, this should point to a GuiObject.

PlayerGui also has every member of BasePlayerGui. Deprecated and Roblox-only members are hidden.

Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.