AddPlayerStat
addPlayerStat
Adds a signed amount to an authoritative numeric progression stat.
Syntax
bool addPlayerStat(int playerId, string statName, number amount)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player to update. |
statName |
string |
yes | A supported stat key. |
amount |
number |
yes | Amount to add; use a negative number to subtract. |
Returns
Returns true when the updated value is accepted; otherwise returns false.
Examples
Heal a player by ten points:
addPlayerStat(playerId, "health", 10)
Notes
- Available only in server-side resource scripts.