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, the player’s name, seat, score and hand of cards. Undefined before the player joins, and on a room’s own world. The player’s character is useCharacter(), and what the player’s camera follows useViewTarget(). As Roblox’s Players.LocalPlayer.

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

Entity | undefined