Skip to content

PlayerSnapshot

A player as the server last saw them. A snapshot never changes; read players.getById again for a newer one. You get them in events and decisions, from players.getById and from players.listOnline.

Renamed in 0.28 from Player; see renamed names.

type PlayerSnapshot = Readonly<{
id: number;
connectionId: string;
name: string;
position: Vector3 | null;
listenPosition: Vector3 | null;
facingAngleRadians: number | null;
health: number | null;
armour: number | null;
skinModel: number | null;
weaponId: number | null;
vehicleId: number | null;
seat: number | null;
interior: number | null;
virtualWorld: number;
wantedLevel: number | null;
audioZone: AudioZone | null;
state: PlayerState;
observedAtServerMs: number;
}>;
type PlayerInVehicle = PlayerSnapshot & { readonly vehicleId: number; readonly seat: number };
type PlayerState = "held" | "spawning" | "onFoot" | "driver" | "passenger" | "dead" | "busted";
Field Type Description
id number The player’s ID, from 1. A later player can get the same ID after this one leaves.
connectionId string This connection. A player who leaves and comes back, or a new player with the same ID, has another one.
name string The nickname.
position Vector3 or null Where the player is, in metres; z is height.
listenPosition Vector3 or null Where the player hears nearby chat: position, unless players.setListenPosition set one or they watch a view started with listenAtView. Use it for your own “who is near” checks.
facingAngleRadians number or null Which way they face, in radians.
health, armour number or null 0 to 1000; 100 is a normal maximum.
skinModel number or null The skin model.
weaponId number or null The weapon in hand.
vehicleId number or null The vehicle they are in, or null on foot.
seat number or null Their seat: 0 the driver’s, 1 to 3 a passenger’s.
interior number or null The interior: 0 outside, 1 to 18 an interior’s.
virtualWorld number The virtual world: 0 unless your gamemode moved them with players.setVirtualWorld.
wantedLevel number or null The wanted level, 0 to 6.
audioZone AudioZone or null The game’s ambient audio zone they are in: { name, audioId }.
state PlayerState held, spawning, onFoot, driver, passenger, dead or busted; see states.
observedAtServerMs number When the server saw this, in Unix milliseconds on the server’s clock.