Reference API Roblox

Engine API

Website

Related

Reference API Roblox

PlayerGui

A container that holds a player's UI.

This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is player-replicated. Its data is replicated between the server and only a single client.
Tags: [NotCreatable, PlayerReplicated]

Member index 6

HistoryMember
726CurrentScreenOrientation: ScreenOrientation
726ScreenOrientation: ScreenOrientation
726SelectionImageObject: GuiObject
462GetTopbarTransparency(): float
573SetTopbarTransparency(transparency: float): null
462TopbarTransparencyChangedSignal(transparency: float)
inherited from BasePlayerGui
648GetGuiObjectsAtPosition(x: int, y: int): Instances
648GetGuiObjectsInCircle(position: Vector2, radius: float): Instances
inherited from Instance
726Archivable: bool
726Capabilities: SecurityCapabilities
726IsInSandbox: bool
726Name: string
726Parent: Instance
726PredictionMode: PredictionMode
726Sandboxed: bool
726UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
726children(): Instances
726clone(): Instance
726destroy(): null
726findFirstChild(name: string, recursive: bool = false): Instance
726getChildren(): Instances
726isDescendantOf(ancestor: Instance): bool
726remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
726childAdded(child: Instance)
inherited from Object
726ClassName: string
726className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
726isA(className: string): bool
647Changed(property: string)

Removed member index 1

HistoryMember

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:

1
2
3
4
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local playerGui = player.PlayerGui

History 36

Members 6

CurrentScreenOrientation

TypeDefault
ScreenOrientation

Describes the player's current screen orientation.

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 5

Tags: [ReadOnly, NotReplicated]

GetTopbarTransparency

Parameters (0)
No parameters.
Returns (1)
float

Returns the transparency of the Topbar.

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 5

Tags: [Deprecated]

ScreenOrientation

TypeDefault
ScreenOrientation

Sets the preferred screen orientation mode for this player, if on a mobile device.

History 5

SelectionImageObject

TypeDefault
GuiObject

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

History 6

SetTopbarTransparency

Parameters (1)
transparencyfloat
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.

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 6

Tags: [Deprecated]

TopbarTransparencyChangedSignal

Parameters (1)
transparencyfloat

Fires when the transparency of the Topbar CoreGui changes.

This event is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 5

Tags: [Deprecated]

Removed members 1

Settings