Reference API Roblox

Engine API

Website

Related

Reference API Roblox

BillboardGui

A container for GuiObjects that renders in 3D space facing the camera.

Member index 19

HistoryMember
553Active: bool
553Adornee: Instance
553AlwaysOnTop: bool
553Brightness: float
553ClipsDescendants: bool
553CurrentDistance: float
553DistanceLowerLimit: float
553DistanceStep: float
553DistanceUpperLimit: float
553ExtentsOffset: Vector3
553ExtentsOffsetWorldSpace: Vector3
553LightInfluence: float
553MaxDistance: float
553PlayerToHideFrom: Instance
553Size: UDim2
553SizeOffset: Vector2
553StudsOffset: Vector3
553StudsOffsetWorldSpace: Vector3
490GetScreenSpaceBounds(): Variant
inherited from LayerCollector
553Enabled: bool
553ResetOnSpawn: bool
553ZIndexBehavior: ZIndexBehavior
648GetGuiObjectsAtPosition(x: int, y: int): Instances
462GetLayoutNodeTree(): Dictionary
inherited from GuiBase2d
553AbsolutePosition: Vector2
553AbsoluteRotation: float
553AbsoluteSize: Vector2
553AutoLocalize: bool
553RootLocalizationTable: LocalizationTable
553SelectionBehaviorDown: SelectionBehavior
553SelectionBehaviorLeft: SelectionBehavior
553SelectionBehaviorRight: SelectionBehavior
553SelectionBehaviorUp: SelectionBehavior
553SelectionGroup: bool
525SelectionChanged(amISelected: bool, previousSelection: GuiObject, newSelection: GuiObject)
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)

Removed member index 1

HistoryMember
310Enabled: bool

Description

BillboardGuis are containers for GuiObjects that appear in the 3D space. BillboardGuis always face the camera, and can either change size with distance or remain the same size on the screen based on the BillboardGui.Size property.

Their position is relative to the BillboardGui.Adornee. If no Adornee is set, then the parent of the BillboardGui will be used as the adornee. For BaseParts, the Position property will be used. For Attachments, the WorldPosition property will be used.

The Size property of a BillboardGui works slightly differently than GuiObject.Size. The Offset portion works the same, but the Scale portion is used as a size in studs in 3D space.

A size of UDim2.fromScale(4, 5) is 4x5 studs, and scales the UI larger and smaller depending on distance from the camera. A size of UDim2.fromOffset(200, 100) is always 200x100 on the screen, and does not change size with distance. Scale and Offset values can also be combined together, like with GuiObject.Size.

When creating size-scaled BillboardGuis, it's important to make sure all the UI objects within are using Scale sizing and all text has TextLabel.TextScaled enabled, to ensure correct scaling.

The AbsolutePosition property of a BillboardGui and all of its descendants is relative to the top left corner of its canvas, and so is always 0, 0 for the BillboardGui instance.

Caching Static UI for Performance

A Gui's appearance is cached until one of the following events occurs:

  • A descendant is added to the Gui.
  • A descendant is removed from the Gui.
  • A property of a descendant of the Gui changes.
  • A property of the Gui changes.

If any of these events occur, the Gui's appearance will be recomputed the next frame it gets rendered.

History 83

Members 19

Active

TypeDefault
boolfalse

Controls whether the descendants will receive input events. If the UI contains a GuiButton then that button will become clickable only if Active is set to true on both the BillboardGui and the button.

BillboardGuis will only receive user input if they are parented to the PlayerGui. The BillboardGui.Adornee property can be used to target a Part in the workspace while the UI itself is in the PlayerGui.

History 4

Adornee

TypeDefault
Instance

Sets the target part or attachment that the BillboardGui is positioned relative to. If no Adornee is set, then the Parent is used instead.

History 5

AlwaysOnTop

TypeDefault
boolfalse

Determines whether the BillboardGui will render over top of 3D content, or be occluded by it.

When set to false, the BillboardGui will render like other 3D content, and will be occluded by other 3D objects.

When set to true, it always renders on top of 3D content, and the appearance changes significantly:

History 4

Brightness

TypeDefault
float1

Brightness determines the factor by which the GUI's emitted light is scaled. By default, this property is 1 and can be set to any number on the range [0, 1000].

By modifying this property, the apparent brightness of a GUI can be better matched to its environment. For instance, a video billboard like those found in Times Square can be made brighter to be clearly visible on a bright day.

This property won't produce any effect in the following scenarios wherein the GUI does not emit light.:

  • When AlwaysOnTop is true, the color of each pixel is the color shown on-screen.
  • When LightInfluence is 1, all light from the GUI is reflected from the environment instead of being emit.

History 4

ClipsDescendants

TypeDefault
boolfalse

When set to true, portions of GuiObjects that fall outside of the BillboardGui's canvas borders will not be drawn.

Even when this property is false, objects that are completely outside of the canvas of the BillboardGui will not render.

History 4

CurrentDistance

TypeDefault
float0

The current distance in studs that the BillboardGui is from the player's camera. A changed event does not fire for this property unless the gui's BillboardGui.DistanceStep is more than 0.

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]

DistanceLowerLimit

TypeDefault
float0

Determines the distance in studs that a BillboardGui will stop scaling larger in size at relative to the player's current camera. If the distance of the gui is below this value, it will not be scaled any larger than it would be at this distance. The value of this property defaults to 0 studs.

History 4

DistanceStep

TypeDefault
float0

Determines the size BillboardGui.CurrentDistance increments and decrements in studs as the player's camera moves closer and further from the BillboardGui. The property defaults to 0 and rounds up starting from BillboardGui.DistanceLowerLimit.

For example, if this property is set to 0.5 and the player's camera is moving away from the gui starting from 0 then CurrentDistance will increase 0 -> 0.5 -> 1 -> 1.5 -> ... and so forth.

History 4

DistanceUpperLimit

TypeDefault
float-1

Determines the distance in studs that a BillboardGui will stop scaling smaller in size at relative to the player's current camera. If the distance of the gui is above this value, it will not be scaled any smaller than it would be at this distance.

This property is ignored if the value is less than 0. The default value is -1, meaning the property is ignored by default.

History 4

ExtentsOffset

TypeDefault
Vector30, 0, 0

ExtentsOffset determines how the BillboardGui is offset from its Adornee, relative to the Camera orientation and units are half the dimensions of the model's Camera-aligned bounding box.

See also:

History 4

ExtentsOffsetWorldSpace

TypeDefault
Vector30, 0, 0

ExtentsOffsetWorldSpace determines how the BillboardGui is offset from its Adornee, relative to the global axes and units are half the dimensions of the model's axis-aligned bounding box.

See also:

History 4

GetScreenSpaceBounds

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

History 1

LightInfluence

TypeDefault
float0

Controls how much the BillboardGui is influenced by the lighting in the environment.

When set to 0, the UI behaves similarly to an LCD screen, acting as its own light source and appearing the same regardless of the surrounding lighting.

When set to 1, the UI behaves similarly to a piece of paper, only reflecting the light from another source.

History 4

MaxDistance

TypeDefault
floatINF

The MaxDistance property of a BillboardGui sets how far away in studs that billboard can be from the camera and still be drawn. If the camera and billboard are moved further apart than the maximum distance, then the billboard will not be visible regardless of any other properties of the billboard or any GUI objects it contains. The default value of this property is infinity

If this value is set to less than or equal to 0 then the maximum distance will be treated as infinite and the billboard will always be drawable.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-- Wait for default camera/control scripts to load
task.wait(5)

-- Declare and initialize objects
local camera = workspace.CurrentCamera
local part = Instance.new("Part")
local billboard = Instance.new("BillboardGui")
local label = Instance.new("TextLabel")

-- Set up camera type
camera.CameraType = Enum.CameraType.Scriptable

-- Set part's position and lock in place
part.CFrame = CFrame.new(0, 10, 0)
part.Anchored = true

-- Set up billboard
billboard.MaxDistance = 10
billboard.Adornee = part
billboard.AlwaysOnTop = true
billboard.Size = UDim2.fromOffset(50, 50)

-- Set up label
label.Size = UDim2.fromScale(1, 1)

-- Set parents of objects
label.Parent = billboard
billboard.Parent = part
part.Parent = workspace

-- Move camera next to part. Wait a bit and then move camera
local cameraPosition0 = part.Position + Vector3.new(0, 0, 10)
local cameraPosition1 = part.Position + Vector3.new(0, 0, 20)
camera.CFrame = CFrame.lookAt(cameraPosition0, part.Position)

-- Contents of billboard will be visible here
task.wait(2)
camera.CFrame = CFrame.lookAt(cameraPosition1, part.Position)
-- Contents of billboard will no longer be visible (outside MaxDistance)

History 4

PlayerToHideFrom

TypeDefault
Instance

Used by scripts to hide the BillboardGui from a specific player.

To hide the UI from more than one player, place the BillboardGui into StarterGui and use a script to set the BillboardGui.Enabled property according to whether the Players.LocalPlayer should be able to see it. The BillboardGui.Adornee property can be used to attach the BillboardGui to a Part or Attachment in the Workspace, instead of parenting it.

History 5

Size

TypeDefault
UDim2{0, 0}, {0, 0}

Controls the size that the BillboardGui will have on screen.

The Scale component of the Size is interpreted as a size in studs, and the UI will automatically scale with distance if Scale values are used.

The Scale and Offset portions of the size are added together, and can be used at the same time.

History 4

  • 553 Change Default of Size from to UDim2({0, 0}, {0, 0})
  • 486 Change ThreadSafety of Size from ReadOnly to ReadSafe
  • 462 Change ThreadSafety of Size from to ReadOnly
  • 47 Add Size

SizeOffset

TypeDefault
Vector20, 0

A 2D offset in size-relative units that acts like an anchor point. This can be used similarly to the GuiObject.AnchorPoint property, but the values are different.

Common Values

SizeOffsetExplanation
0.0, 0.0The default. The UI will be anchored at its center.
0.5, 0.5The UI will anchor at the bottom left.
0.5, -0.5The UI will anchor at the top left.
-0.5, 0.5The UI will anchor at the top right.
-0.5, -0.5The UI will anchor at the bottom right.

See also:

History 4

StudsOffset

TypeDefault
Vector30, 0, 0

StudsOffset determines how the BillboardGui is offset from its Adornee, relative to the Camera orientation with units in studs.

See also:

  • StudsOffsetWorldSpace, which works similarly except the offset orientation is relative to the global axes
  • ExtentsOffset, which works similarly except the units are half the dimensions of the model's Camera-aligned bounding box

History 4

StudsOffsetWorldSpace

TypeDefault
Vector30, 0, 0

StudsOffsetWorldSpace determines how the BillboardGui is offset from its Adornee, relative to the global axes with units in studs.

See also:

  • StudsOffset, which works similarly except the offset orientation is relative to the Camera
  • ExtentsOffsetWorldSpace, which works similarly except the units are half the dimensions of the model's axis-aligned bounding box

History 4

Removed members 1

Enabled

TypeDefault
bool

History 4

Settings