ðŸĪEvents

Events allow you to provide a function that will be run when an action occurs:

-- Execute entities when their health falls under 20
Events.EntityDamage(function(event)
    if (event.entity:getHealth() < 20) then
        event.entity.kill()
    end
end)

You can also modify (or sometimes cancel) event data:

-- Double all damage in the game after 15 minutes
Events.EntityDamage(function(event)
    local matchDurationSec = MatchService:getMatchDurationSec()
    if (matchDurationSec > 15 * 60) then
        event.damage = event.damage * 2
    end
end)

Last updated