SetPlayerStat
Jump to navigation
Jump to search
setPlayerStat
Sets an authoritative numeric progression stat for a connected player.
Syntax
bool setPlayerStat(int playerId, string statName, number value)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player to update. |
statName |
string |
yes | A supported stat key. |
value |
number |
yes | The new value, clamped to the stat's allowed range. |
Returns
Returns true when the update is accepted; otherwise returns false.
Examples
Set a player's strength:
if not setPlayerStat(playerId, "strength", 50) then
outputDebugString("Could not set strength", 1)
end
Notes
- Available only in server-side resource scripts.
- Progression changes are server-authoritative and replicated to the owning client.