SetPlayerBody
setPlayerBody
Changes a player's authoritative full-body identity preset.
Syntax
bool setPlayerBody(int playerId, string bodyKey)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
bodyKey |
string |
yes | A stable key returned by getPlayerBodyNames.
|
Returns
Returns true when the compatible preset is accepted and replicated; otherwise returns false.
Examples
Use Milten's complete prebaked character model:
if not setPlayerBody(playerId, "milten") then
outputChatBox("The body preset could not be applied.", playerId)
end
Notes
- Available only in server-side resource scripts.
- A named body contains its original head because G1R does not export those NPC meshes as independently composable body parts.
- Set the head to
defaultbefore selecting a named body. Non-default heads are valid only withbody = default. - The reliable state is replayed during relevance entry and late join.
- This emits
onPlayerBodyChangewhen accepted.