Class
PlayerGui
NotCreatablePlayerReplicated
A container that holds a player's UI.
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#
CurrentScreenOrientationScreenOrientation | Describes the player's current screen orientation.ReadSafeReadOnlyNotReplicated |
ScreenOrientationScreenOrientation | Sets the preferred screen orientation mode for this player, if on a mobile device.ReadSafe |
SelectionImageObjectGuiObject | Overrides the default selection adornment used for gamepads.ReadSafe |
CurrentScreenOrientation: ScreenOrientation#
ReadOnlyNotReplicatedReadSafe
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: ScreenOrientation#
ReadSafe
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: GuiObject#
ReadSafe
Overrides the default selection adornment used for gamepads. For best
results, this should point to a GuiObject.
Methods 2#
| GetTopbarTransparency | Returns the transparency of the Topbar. |
| SetTopbarTransparency | Sets the transparency of the top bar. |
GetTopbarTransparency(): float#
Deprecated
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.
Returns
float— The current topbar transparency, a number between 0 (completely opaque) and 1 (completely transparent).
SetTopbarTransparency(transparency: float): ()#
Deprecated
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.
| Name | Type | Default | Description |
|---|---|---|---|
transparency | float | A number between 0 (completely opaque) and 1 (completely transparent). Values outside this range are clamped. |
Returns
()
Events 1#
| TopbarTransparencyChangedSignal | Fires when the transparency of the Topbar CoreGui changes. |
TopbarTransparencyChangedSignal(transparency: float)#
Deprecated
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.
| Name | Type | Default | Description |
|---|---|---|---|
transparency | float | The new topbar transparency after the change, a number between 0 (completely opaque) and 1 (completely transparent). |
Inherited members#
Inherited from BasePlayerGui 1
Methods (1)
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild