Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Global objectClient APIGenerated

Nametags

const Nametags: object

Defined in: client/api.d.ts:5391

The local player’s view of the nametags above players: whether they draw at all, whether they carry a health bar, and whether their own is shown.

clearLabel(entityId): void

Removes an entity’s label before its duration elapses.

number

Network id of the entity whose label to remove.

void

clearLabels(): void

Removes every label this player is drawing.

void

isHealthVisible(): boolean

Checks whether this player draws health bars on nametags.

boolean

True unless they were hidden locally.

isSelfVisible(): boolean

Checks whether this player draws their own nametag.

boolean

False unless it was turned on locally.

isVisible(): boolean

Checks whether this player draws nametags.

boolean

True unless they were hidden locally.

setHealthVisible(visible): void

Shows or hides the health bar on all nametags for this player only, leaving the names alone.

boolean

True to draw the health bar under each name, false to hide it.

void

setLabel(entityId, text, durationMs?, color?): void

Hangs a transient line on that entity’s nametag, above its name – speech, an emote, a status. It follows the body, fades with distance and hides behind cover exactly as the name does. Local to this player: the line is not replicated, and a nametag hidden with Nametags.setVisible draws neither. Player.setNametagText is the server-side counterpart for a lasting name.

number

Network id of the entity to label (server-side player.id).

string

Label text; ‘\n’ splits lines. Empty clears the label.

number

How long to hold it (default 6000). <= 0 holds until cleared.

number

Packed 0xAARRGGBB; 0 (default) uses the nametag’s own colour.

void

setSelfVisible(visible): void

Shows or hides this player’s own nametag, drawn as others see it, with any label set on their own id.

boolean

True to draw this player’s own nametag, false (default) to leave it off.

void

setVisible(visible): void

Shows or hides all nametags for this player only. A player hidden with Player.setNametagVisible stays hidden either way.

boolean

True to draw nametags, false to hide every one of them.

void