Skip to content

playerSpawnRequest

Asks your gamemode about every spawn: the first, and each respawn after a death or an arrest.

Renamed in 0.28 from spawnRequest; see renamed names.

server.on("playerSpawnRequest", ({ player, spawnKind, position, facingAngleRadians }) => SpawnDecision | false | Promise<SpawnDecision | false>)
Name Type Description
player PlayerSnapshot The player.
spawnKind "initial" | "respawn" The first spawn, or one after dying or being arrested.
position Vector3 Where the server would spawn them.
facingAngleRadians number The facing the server would use, in radians.

{ decision: "allow" } spawns the player as the server would; { decision: "allow", spawn } chooses position, facingAngleRadians, skin, health and armour (each optional, ranges as in players.spawn), and { decision: "hold" } (or false) keeps the player held. Returning nothing spawns them. The first handler that holds or allows decides. See how decisions work.

Respawn at a hospital; the first spawn at Grove Street.

gamemodes/my-mode.ts
import { server } from "nativemp";
server.on("playerSpawnRequest", ({ spawnKind }) => {
if (spawnKind === "initial") return { decision: "allow", spawn: { position: [2495.3, -1687.5, 13.5], skin: 0 } };
return { decision: "allow", spawn: { position: [1172.4, -1323.3, 15.4], health: 100 } }; // All Saints
});