Skip to content
M2O Scripting APIScripting reference
Runtime classServer APIGenerated

TextLabel

Defined in: server/api.d.ts:4329

Server-created replicated world-space text label.

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.

number

Existing text-label network entity identifier.

TextLabel

Entity.constructor

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.

number | Entity

The entity to follow, or its network id.

Vector3 | { x: number; y: number; z: number; }

Where to draw relative to it; the game decides the reference point (a player’s head, say).

void


destroy(): void

Defined in: server/api.d.ts:4375

Destroys this replicated label; stale wrappers no longer resolve afterward.

void


detach(): void

Defined in: server/api.d.ts:4410

Stops following an entity; the label returns to its own position.

void


getOptions(): TextLabelOptions

Defined in: server/api.d.ts:4437

The label’s current look and placement, in the shape update() takes.

TextLabelOptions


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.

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.

void


setDrawDistance(distance): void

Defined in: server/api.d.ts:4393

Changes how far away clients can render the label.

number

Maximum rendering distance in world units, clamped from 1 to 1000 metres’ worth.

void


setFadeDistance(distance): void

Defined in: server/api.d.ts:4399

Changes where the label starts fading out.

number

Distance in world units where fading starts; 0 starts it at 75% of the draw distance.

void


setFontSize(size): void

Defined in: server/api.d.ts:4387

Changes the rendered font size.

number

Font size in pixels, clamped from 1 to 512.

void


setStyle(style): void

Defined in: server/api.d.ts:4405

Resets the outline, shadow and background to a preset.

number

0 none, 1 shadow, 2 outline, 3 box; unsupported values are ignored.

void


setText(text): void

Defined in: server/api.d.ts:4381

Changes the label’s displayed text.

string

Replacement text replicated to clients; at most 1024 bytes.

void


setVirtualWorld(world): void

Defined in: server/api.d.ts:4154

Moves this entity into another virtual world.

number

Virtual-world identifier used to partition replication and visibility.

void

Entity.setVirtualWorld


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.

Entity | null

Player-owned entity whose connection should exclusively receive this entity, or null to clear the restriction.

void

Entity.setVisibleTo


toString(): string

Defined in: server/api.d.ts:4370

Formats this label for logging and debugging.

string

Text containing the label ID and current text.

Entity.toString


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.

TextLabelOptions

Only the keys given change; outline, shadow and background are replaced whole.

void


static create(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.

number

World-space X coordinate.

number

World-space Y coordinate.

number

World-space Z coordinate.

string

Initial displayed text.

number | TextLabelOptions

Look and placement, or (the older form) the font size from 1 to 512.

number

Older form only: the draw distance in world units.

number

Older form only: the virtual-world identifier.

TextLabel

Handle for the newly created label.

readonly color: number

Defined in: server/api.d.ts:4344

Current packed ARGB color.


readonly drawDistance: number

Defined in: server/api.d.ts:4354

Current maximum rendering distance in world units.


readonly fadeDistance: number

Defined in: server/api.d.ts:4359

Distance in world units where fading starts.


readonly fontSize: number

Defined in: server/api.d.ts:4349

Current font size.


readonly id: number

Defined in: server/api.d.ts:4122

Immutable network entity identifier.

Entity.id


position: Vector3

Defined in: server/api.d.ts:4132

Authoritative world-space position; assignment forces replicated state.

Entity.position


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.

Entity.rotation


readonly state: 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.

Entity.state


readonly style: number

Defined in: server/api.d.ts:4364

The preset nearest the current look: 0 none, 1 shadow, 2 outline, 3 box.


readonly text: string

Defined in: server/api.d.ts:4339

Current replicated label text.


readonly virtualWorld: number

Defined in: server/api.d.ts:4127

Current virtual-world identifier.

Entity.virtualWorld