import { world } from "@minecraft/server";world.afterEvents.playerSpawn.subscribe((eventData) => { const { player, initialSpawn } = eventData; if (!initialSpawn) return; // This runs when the player joins the game for the first time!}); Copy
import { world } from "@minecraft/server";world.afterEvents.playerSpawn.subscribe((eventData) => { const { player, initialSpawn } = eventData; if (!initialSpawn) return; // This runs when the player joins the game for the first time!});
Private
This function can be called in early-execution mode.
This function can't be called in read-only mode.
Example: initialSpawnEvent.js