Skip to content
M2O Scripting APIScripting reference
Runtime classServer APIGenerated

TextLabel

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

Server-created replicated world-space text label.

new TextLabel(id): TextLabel

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

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:4654

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:4597

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

void


detach(): void

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

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

void


getOptions(): TextLabelOptions

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

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:4641

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:4615

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:4621

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:4609

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:4627

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:4603

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:4371

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:4377

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:4592

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:4647

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:4672

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:4566

Current packed ARGB color.


readonly drawDistance: number

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

Current maximum rendering distance in world units.


readonly fadeDistance: number

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

Distance in world units where fading starts.


readonly fontSize: number

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

Current font size.


readonly id: number

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

Immutable network entity identifier.

Entity.id


position: Vector3

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

Authoritative world-space position; assignment forces replicated state.

Entity.position


rotation: Vector3 | Quaternion

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

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:4359

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:4586

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


readonly text: string

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

Current replicated label text.


readonly virtualWorld: number

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

Current virtual-world identifier.

Entity.virtualWorld