Skip to content

textLabels.getById

Returns one of your text labels by its ID, or undefined when there is none.

Renamed in 0.28 from labels.get; see renamed names.

textLabels.getById(id: number): TextLabel | undefined
Name Type Description
id number The ID from textLabels.create.

The TextLabel, or undefined for an ID that is not one of your text labels.

gamemodes/my-mode.ts
import { textLabels, server } from "nativemp";
const markerId = 0; // the ID textLabels.create returned
const marker = textLabels.getById(markerId);
if (marker) server.log(`It is in virtual world ${marker.virtualWorld}`);