TextLabel
Defined in: server/api.d.ts:4329
Server-created replicated world-space text label.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TextLabel(
id):TextLabel
Defined in: server/api.d.ts:4334
Creates a wrapper for an existing text label; use TextLabel.create to spawn one.
Parameters
Section titled “Parameters”number
Existing text-label network entity identifier.
Returns
Section titled “Returns”TextLabel
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”attachTo()
Section titled “attachTo()”attachTo(
target,offset?):void
Defined in: server/api.d.ts:4432
Follows another live entity instead of staying at the label’s own position. It streams from where the target is, moves into its virtual world and is destroyed with it.
Parameters
Section titled “Parameters”target
Section titled “target”number | Entity
The entity to follow, or its network id.
offset?
Section titled “offset?”Vector3 | { x: number; y: number; z: number; }
Where to draw relative to it; the game decides the reference point (a player’s head, say).
Returns
Section titled “Returns”void
destroy()
Section titled “destroy()”destroy():
void
Defined in: server/api.d.ts:4375
Destroys this replicated label; stale wrappers no longer resolve afterward.
Returns
Section titled “Returns”void
detach()
Section titled “detach()”detach():
void
Defined in: server/api.d.ts:4410
Stops following an entity; the label returns to its own position.
Returns
Section titled “Returns”void
getOptions()
Section titled “getOptions()”getOptions():
TextLabelOptions
Defined in: server/api.d.ts:4437
The label’s current look and placement, in the shape update() takes.
Returns
Section titled “Returns”setColor()
Section titled “setColor()”setColor(
colorOrR,g?,b?,a?):void
Defined in: server/api.d.ts:4419
Changes the label’s packed ARGB color from a Color or byte components.
Parameters
Section titled “Parameters”colorOrR
Section titled “colorOrR”number | Color
A Color, or the red byte (0-255) when passing components.
number
Green byte (0-255) when passing components.
number
Blue byte (0-255) when passing components.
number
Alpha byte (0-255) when passing components; defaults to 255.
Returns
Section titled “Returns”void
setDrawDistance()
Section titled “setDrawDistance()”setDrawDistance(
distance):void
Defined in: server/api.d.ts:4393
Changes how far away clients can render the label.
Parameters
Section titled “Parameters”distance
Section titled “distance”number
Maximum rendering distance in world units, clamped from 1 to 1000 metres’ worth.
Returns
Section titled “Returns”void
setFadeDistance()
Section titled “setFadeDistance()”setFadeDistance(
distance):void
Defined in: server/api.d.ts:4399
Changes where the label starts fading out.
Parameters
Section titled “Parameters”distance
Section titled “distance”number
Distance in world units where fading starts; 0 starts it at 75% of the draw distance.
Returns
Section titled “Returns”void
setFontSize()
Section titled “setFontSize()”setFontSize(
size):void
Defined in: server/api.d.ts:4387
Changes the rendered font size.
Parameters
Section titled “Parameters”number
Font size in pixels, clamped from 1 to 512.
Returns
Section titled “Returns”void
setStyle()
Section titled “setStyle()”setStyle(
style):void
Defined in: server/api.d.ts:4405
Resets the outline, shadow and background to a preset.
Parameters
Section titled “Parameters”number
0 none, 1 shadow, 2 outline, 3 box; unsupported values are ignored.
Returns
Section titled “Returns”void
setText()
Section titled “setText()”setText(
text):void
Defined in: server/api.d.ts:4381
Changes the label’s displayed text.
Parameters
Section titled “Parameters”string
Replacement text replicated to clients; at most 1024 bytes.
Returns
Section titled “Returns”void
setVirtualWorld()
Section titled “setVirtualWorld()”setVirtualWorld(
world):void
Defined in: server/api.d.ts:4154
Moves this entity into another virtual world.
Parameters
Section titled “Parameters”number
Virtual-world identifier used to partition replication and visibility.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”setVisibleTo()
Section titled “setVisibleTo()”setVisibleTo(
player):void
Defined in: server/api.d.ts:4160
Restricts replication of this entity to one owning connection while preserving normal range and visibility checks.
Parameters
Section titled “Parameters”player
Section titled “player”Entity | null
Player-owned entity whose connection should exclusively receive this entity, or null to clear the restriction.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”toString()
Section titled “toString()”toString():
string
Defined in: server/api.d.ts:4370
Formats this label for logging and debugging.
Returns
Section titled “Returns”string
Text containing the label ID and current text.
Inherited from
Section titled “Inherited from”update()
Section titled “update()”update(
options):void
Defined in: server/api.d.ts:4425
Changes any part of the label at once. A bad key throws and changes nothing.
Parameters
Section titled “Parameters”options
Section titled “options”Only the keys given change; outline, shadow and background are replaced whole.
Returns
Section titled “Returns”void
create()
Section titled “create()”
staticcreate(x,y,z,text,fontSizeOrOptions?,drawDistance?,virtualWorld?):TextLabel
Defined in: server/api.d.ts:4450
Creates and replicates a world-space text label, up to the server-wide limit of 512. A bad option throws and creates nothing.
Parameters
Section titled “Parameters”number
World-space X coordinate.
number
World-space Y coordinate.
number
World-space Z coordinate.
string
Initial displayed text.
fontSizeOrOptions?
Section titled “fontSizeOrOptions?”number | TextLabelOptions
Look and placement, or (the older form) the font size from 1 to 512.
drawDistance?
Section titled “drawDistance?”number
Older form only: the draw distance in world units.
virtualWorld?
Section titled “virtualWorld?”number
Older form only: the virtual-world identifier.
Returns
Section titled “Returns”TextLabel
Handle for the newly created label.
Properties
Section titled “Properties”
readonlycolor:number
Defined in: server/api.d.ts:4344
Current packed ARGB color.
drawDistance
Section titled “drawDistance”
readonlydrawDistance:number
Defined in: server/api.d.ts:4354
Current maximum rendering distance in world units.
fadeDistance
Section titled “fadeDistance”
readonlyfadeDistance:number
Defined in: server/api.d.ts:4359
Distance in world units where fading starts.
fontSize
Section titled “fontSize”
readonlyfontSize:number
Defined in: server/api.d.ts:4349
Current font size.
readonlyid:number
Defined in: server/api.d.ts:4122
Immutable network entity identifier.
Inherited from
Section titled “Inherited from”position
Section titled “position”position:
Vector3
Defined in: server/api.d.ts:4132
Authoritative world-space position; assignment forces replicated state.
Inherited from
Section titled “Inherited from”rotation
Section titled “rotation”rotation:
Vector3|Quaternion
Defined in: server/api.d.ts:4137
Authoritative rotation; reads return a quaternion and assignments accept a quaternion or Euler angles in degrees.
Inherited from
Section titled “Inherited from”
readonlystate:StateBag
Defined in: server/api.d.ts:4142
Arbitrary key/value state carried by this entity. The server writes it and every client that can see the entity receives it; see StateBag.
Inherited from
Section titled “Inherited from”
readonlystyle:number
Defined in: server/api.d.ts:4364
The preset nearest the current look: 0 none, 1 shadow, 2 outline, 3 box.
readonlytext:string
Defined in: server/api.d.ts:4339
Current replicated label text.
virtualWorld
Section titled “virtualWorld”
readonlyvirtualWorld:number
Defined in: server/api.d.ts:4127
Current virtual-world identifier.
