PlayerGui
A container that holds a player's UI.
| Memory category | Instances |
|---|
Member index 7
Description
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:
History 40
- 731 Change Default of SelectionImageObject from to
- 731 Change Default of ScreenOrientation from to LandscapeSensor
- 731 Add
- 731 Change Default of CurrentScreenOrientation from to LandscapeLeft
- 726 Change Default of SelectionImageObject from to
- 726 Change Default of ScreenOrientation from LandscapeSensor to
- 726 Remove
- 726 Change Default of CurrentScreenOrientation from LandscapeLeft to
- 698 Add
- 573 Change ReturnType of SetTopbarTransparency from void to null
- 553 Change Default of SelectionImageObject from to
- 553 Change Default of ScreenOrientation from to LandscapeSensor
- 553 Change Default of CurrentScreenOrientation from to LandscapeLeft
- 486 Change ThreadSafety of SelectionImageObject from ReadOnly to ReadSafe
- 486 Change ThreadSafety of ScreenOrientation from ReadOnly to ReadSafe
- 486 Change ThreadSafety of CurrentScreenOrientation from ReadOnly to ReadSafe
- 462 Change ThreadSafety of TopbarTransparencyChangedSignal from to Unsafe
- 462 Change ThreadSafety of SetTopbarTransparency from to Unsafe
- 462 Change ThreadSafety of GetTopbarTransparency from to Unsafe
- 462 Change ThreadSafety of SelectionImageObject from to ReadOnly
- 462 Change ThreadSafety of ScreenOrientation from to ReadOnly
- 462 Change ThreadSafety of CurrentScreenOrientation from to ReadOnly
- 459 Change Tags of TopbarTransparencyChangedSignal from [] to [Deprecated]
- 459 Change Tags of SetTopbarTransparency from [] to [Deprecated]
- 459 Change Tags of GetTopbarTransparency from [] to [Deprecated]
- 458 Change Tags of TopbarTransparencyChangedSignal from [Deprecated] to []
- 458 Change Tags of SetTopbarTransparency from [Deprecated] to []
- 458 Change Tags of GetTopbarTransparency from [Deprecated] to []
- 459 Change Tags of TopbarTransparencyChangedSignal from [] to [Deprecated]
- 459 Change Tags of SetTopbarTransparency from [] to [Deprecated]
- 459 Change Tags of GetTopbarTransparency from [] to [Deprecated]
- 329 Change ValueType of SelectionImageObject from Object to GuiObject
- 290 Add ScreenOrientation
- 290 Add CurrentScreenOrientation
- 200 Add SelectionImageObject
- 191 Add TopbarTransparencyChangedSignal
- 191 Add SetTopbarTransparency
- 191 Add GetTopbarTransparency
- 55 Change Tags of PlayerGui from [preliminary, NotCreatable, PlayerReplicated] to [NotCreatable, PlayerReplicated]
- 47 Add PlayerGui
Members 7
CurrentScreenOrientation
| Type | Default | |
|---|---|---|
| ScreenOrientation | LandscapeLeft | |
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.
| Thread safety | ReadSafe |
|---|---|
| Category | Data |
| Loaded/Saved | false |
History 6
- 731 Change Default of CurrentScreenOrientation from to LandscapeLeft
- 726 Change Default of CurrentScreenOrientation from LandscapeLeft to
- 553 Change Default of CurrentScreenOrientation from to LandscapeLeft
- 486 Change ThreadSafety of CurrentScreenOrientation from ReadOnly to ReadSafe
- 462 Change ThreadSafety of CurrentScreenOrientation from to ReadOnly
- 290 Add CurrentScreenOrientation
GetTopbarTransparency
| Parameters (0) | ||
|---|---|---|
| No parameters. | ||
| Returns (1) | ||
| float | ||
Returns the current transparency of the topbar CoreGui, a value in
the range [0, 1] where 0 is completely opaque and 1 is completely
transparent. This is the value previously assigned with
PlayerGui:SetTopbarTransparency(), and it defaults to 0.5. This
method can only be called from a LocalScript; calling it from a
server script raises an error.
| Thread safety | Unsafe |
|---|
History 5
- 462 Change ThreadSafety of GetTopbarTransparency from to Unsafe
- 459 Change Tags of GetTopbarTransparency from [] to [Deprecated]
- 458 Change Tags of GetTopbarTransparency from [Deprecated] to []
- 459 Change Tags of GetTopbarTransparency from [] to [Deprecated]
- 191 Add GetTopbarTransparency
ScreenOrientation
| Type | Default | |
|---|---|---|
| ScreenOrientation | LandscapeSensor | |
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.
| Thread safety | ReadSafe |
|---|---|
| Category | Data |
| Loaded/Saved | true |
History 6
- 731 Change Default of ScreenOrientation from to LandscapeSensor
- 726 Change Default of ScreenOrientation from LandscapeSensor to
- 553 Change Default of ScreenOrientation from to LandscapeSensor
- 486 Change ThreadSafety of ScreenOrientation from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ScreenOrientation from to ReadOnly
- 290 Add ScreenOrientation
SelectionImageObject
| Type | Default | |
|---|---|---|
| GuiObject | ||
Overrides the default selection adornment used for gamepads. For best results, this should point to a GuiObject.
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
History 7
- 731 Change Default of SelectionImageObject from to
- 726 Change Default of SelectionImageObject from to
- 553 Change Default of SelectionImageObject from to
- 486 Change ThreadSafety of SelectionImageObject from ReadOnly to ReadSafe
- 462 Change ThreadSafety of SelectionImageObject from to ReadOnly
- 329 Change ValueType of SelectionImageObject from Object to GuiObject
- 200 Add SelectionImageObject
SetTopbarTransparency
| Parameters (1) | ||
|---|---|---|
| transparency | float | |
| Returns (1) | ||
| null | ||
This method sets the transparency of the top bar CoreGui. A value
of 0 is completely opaque and a value of 1 is completely transparent.
Values outside of the range [0, 1] are clamped. The default transparency
of the topbar is 0.5.
Using the StarterGui:SetCore() method with the "TopbarEnabled"
option allows you to enable/disable the entire topbar and all of its
features (player list, health, etc). By contrast, this method only affects
how the top bar is displayed.
| Thread safety | Unsafe |
|---|
History 6
- 573 Change ReturnType of SetTopbarTransparency from void to null
- 462 Change ThreadSafety of SetTopbarTransparency from to Unsafe
- 459 Change Tags of SetTopbarTransparency from [] to [Deprecated]
- 458 Change Tags of SetTopbarTransparency from [Deprecated] to []
- 459 Change Tags of SetTopbarTransparency from [] to [Deprecated]
- 191 Add SetTopbarTransparency
TopbarTransparencyChangedSignal
| Parameters (1) | |
|---|---|
| transparency | float |
Fires whenever the transparency of the topbar CoreGui changes,
such as after a call to PlayerGui:SetTopbarTransparency(). The
event passes the new transparency as its transparency argument, a value
in the range [0, 1]. It only fires when the clamped transparency differs
from the previous value, so setting the same value again does not re-fire
it.
| Thread safety | Unsafe |
|---|
History 5
- 462 Change ThreadSafety of TopbarTransparencyChangedSignal from to Unsafe
- 459 Change Tags of TopbarTransparencyChangedSignal from [] to [Deprecated]
- 458 Change Tags of TopbarTransparencyChangedSignal from [Deprecated] to []
- 459 Change Tags of TopbarTransparencyChangedSignal from [] to [Deprecated]
- 191 Add TopbarTransparencyChangedSignal