EntityDamage

Fires when an Entity is damaged

Example usage:

Events.EntityDamage(function(event)
    local matchDurationSec = MatchService.getMatchDurationSec()
    -- Double all damage in the game after 15 minutes
    if (matchDurationSec > 15 * 60) then
        event.damage = event.damage * 2
    end
    
    -- Disable damage in first 45s of the game
    if (matchDurationSec < 45) then
        event.cancelled = true;
    end
end)

Parameters

entity: Entity

The entity getting damaged.

fromEntity: Entity | nil

The attacker (if one exists).

damage: number [modifiable]

Amount of damage that will be dealt.

knockback: Knockback [modifiable]

Amount of knockback that will be applied.

cancelled: bool [modifiable]

If set to true the damage will be cancelled.

Last updated