Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

usePlayer

usePlayer(): Entity | undefined

This side’s player entity, as readLocalPlayer reads it, read again each time a player comes or goes and each time an authority changes: what a HUD reads what is the person’s off, her name, her seat, her score, her hand of cards. Undefined before she joins, and on a room’s own world. Her body is useCharacter(), and what her camera follows useViewTarget(). As Roblox’s Players.LocalPlayer.

const player = usePlayer();
const name = useTrait(player, PlayerTrait)?.name;

Entity | undefined