SetMonsterHealth
setMonsterHealth
Sets a monster's authoritative health.
Syntax
bool setMonsterHealth(string monsterId, number health)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
monsterId |
string |
yes | The opaque decimal monster identifier returned by spawnMonster or getMonsters.
|
health |
number |
yes | The non-negative health value to apply. |
Returns
Returns true when the value is accepted; otherwise returns false.
Examples
Restore a monster to full health:
local health, maximum = getMonsterHealth(monsterId)
setMonsterHealth(monsterId, maximum)
Notes
- Available only in server-side resource scripts.
- Setting health to zero transitions the monster into the server-owned death state.