playerSpawned
Tells your gamemode when a player’s game reports them alive after a spawn, their first or a respawn.
Renamed in 0.28 from spawn; see renamed names.
Signature
Section titled “Signature”server.on("playerSpawned", ({ player, spawnKind }) => void)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
player |
PlayerSnapshot |
The player. |
spawnKind |
"initial" | "respawn" |
Their first spawn on this server, or a spawn after dying or being busted. |
Example
Section titled “Example”Arm players on every spawn.
import { players, server } from "nativemp";
server.on("playerSpawned", async ({ player, spawnKind }) => { await players.giveWeapon(player, 22, 100); // pistol});Related
Section titled “Related”playerSpawnRequest: choose where, before it happensplayerDied: a player has died