players.setNameTag
Shows or hides the name, health and armour above one player’s head, for everyone.
Signature
Section titled “Signature”players.setNameTag(player: PlayerTarget, visible: boolean): Promise<ActionResult>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
player |
PlayerTarget |
The player, or their ID. |
visible |
boolean |
false to hide the tag, true to show it again. |
Returns
Section titled “Returns”A promise of an ActionResult: applied once the server has set it, or rejected with player-not-found.
Example
Section titled “Example”Hide undercover players.
import { commands, players } from "nativemp";
commands.register("undercover", async (player) => { await players.setNameTag(player, false);});Related
Section titled “Related”players.setNameColor: the tag’s color
A captured Player keeps this effect bound to its connection across awaits; see Async handlers.