Reference API Roblox

Engine API

Website

Related

Reference API Roblox

PlayerGui

A container for a player's currently rendered ScreenGuis.

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
553CurrentScreenOrientation: ScreenOrientation
553ScreenOrientation: ScreenOrientation
553SelectionImageObject: 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
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: 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
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Description

PlayerGui is a container that holds a player's UI. If a ScreenGui is a descendant, then any GuiObject inside of the ScreenGui will be drawn to 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. Note that if Players.CharacterAutoLoads is set to false, the character will not spawn and StarterGui contents will not be copied until Player:LoadCharacter() is called. If StarterGui.ResetPlayerGuiOnSpawn is set to true, then every time the player's character respawns, all of the contents of that player's PlayerGui are cleared and replaced with the contents of StarterGui.

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 31

Members 6

CurrentScreenOrientation

TypeDefault
ScreenOrientationLandscapeLeft

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 4

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
ScreenOrientationLandscapeSensor

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

History 4

SelectionImageObject

TypeDefault
GuiObject

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

History 5

SetTopbarTransparency

Parameters (1)
transparencyfloat
Returns (1)
null

SetTopbarTransparency() 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]

Settings