Skip to content
FMFallout Multiplayer Scripting APIScripting guides and API
Runtime classServer APIGenerated

TextLabel

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

Text floating in the world on every player’s screen, as FiveM resources draw 3D text: over a shop’s door, a ped’s head, a player. A player sees it while they are in its worldspace or interior and within its range. A label outlives the resource that made it until destroyed. Move it with setPosition or attachTo, not by setting position.

new TextLabel(id): TextLabel

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

Wraps the label with this ID; it creates nothing.

number

Network entity identifier.

TextLabel

Entity.constructor

attachTo(target): boolean

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

Has the label float over a player or an NPC: each player’s game draws it over that body while it has it loaded, and over where the server last saw it otherwise.

Player | Npc | null

Whose body to float over; null to stay where it is.

boolean

False once it is gone.


destroy(): boolean

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

Takes the label off every player’s screen.

boolean

False once it is gone.


setColor(color): boolean

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

Changes the text’s color.

number

0xRRGGBBAA: 0xFFFFFFFF is opaque white.

boolean

False once it is gone.


setPosition(position, space?): boolean

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

Moves the label to a point; it stops floating over anyone.

Vector3

Where, in world units.

{ worldSpace: number; } | { interiorCell: number; }

Where that is; its current space when left out.

boolean

False once it is gone.


setText(text): boolean

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

Changes what the label says.

string

Up to 127 bytes of UTF-8; a line break starts a new line.

boolean

False once it is gone.


setVirtualWorld(world): void

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

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

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

Formats this handle for logging.

string

The label’s network ID and text.

Entity.toString


static all(): TextLabel[]

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

Every label.

TextLabel[]

One handle per label.


static create(options): TextLabel | null

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

Puts floating text in the world for every player, as FiveM’s DrawText3D is drawn: “[E] Shop” over a counter, a name over a head.

text: what it says. position or entity: where it is or whom it floats over. height: how far above, 140 over a body and 0 at a point by default. color: 0xRRGGBBAA, white by default. range: how far from a player it is drawn, 1000 by default, at most 20000. space: a point’s worldspace or interior, the Commonwealth when left out. player: the one player who sees it, everyone when left out.

number

Player | Npc

number

Player

Vector3

number

{ worldSpace: number; } | { interiorCell: number; }

string

TextLabel | null

The label; null when it could not be made. Throws for options without text, or naming neither a position nor a body.

readonly id: number

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

Immutable network entity identifier.

Entity.id


position: Vector3

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

Authoritative world-space position; assignment forces replicated state.

Entity.position


rotation: Vector3 | Quaternion

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

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

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 text: string

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

What it says; empty once it is gone.


readonly virtualWorld: number

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

Current virtual-world identifier.

Entity.virtualWorld