GivePlayerSpell
givePlayerSpell
Grants or clears a player's authoritative spell ownership state.
Syntax
bool givePlayerSpell(int playerId, int|string spell [, bool enabled = true])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
spell |
string | yes | A spell id, a stable spell key, or a value from the global SPELL table. |
enabled |
bool |
no | True to grant the spell or false to revoke it; defaults to true. |
Returns
Returns true when the spell grant state is accepted; otherwise returns false.
Examples
Grant Fire Bolt to a player:
givePlayerSpell(playerId, SPELL.fire_bolt)
Notes
- Available only in server-side resource scripts.
- This is an alias of
setPlayerSpellGranted. - Grant state and cast support are separate. See Synchronized spell catalog and check
getSpellDefinition(spell).implementedbefore exposing a spell to players.