Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

player_spawner

Legacy v6 default-identity avatar setup. v7 scenes place players through the PlayerSpawn / PlayerPrototype flow; this module stands down (M.ensure returns early) for any scene carrying a string playerIntent.

Hooks layers.onLoad: on every non-additive v6 scene load it locates the ensure_default_player-spawned identity entity and binds its avatar:

  • world.avatar_default_<mode> (per-mode world default). The avatar bundle combines visual + controller in one unit (mesh + skeleton + Locomotion + MovementState + CharacterController).
  • Per-scene settings.player.avatar_<mode> overrides the world default when set; "" is the explicit opt-out (the scene builds its own body in entrypoint.luau::onLocalReady).

It spawns a fresh body entity from the bundle, then binds it by assigning the identity's avatar field, which marks the body synced + PlayerOwned and attaches its PlayerAvatar link.

Idempotent per layer: reload doesn't re-instantiate; onUnload clears the per-layer "already applied" flag.

Surface

SymbolNotes
M.install()Idempotent. Registers layers.onLoad / onUnload hooks. Called once from the engine prelude.
M.ensure(sceneProxy) -> entity_id | nilApply the avatar bundle to the identity entity. Returns the identity id, or nil when none exists yet (or the scene is v7).