EntityDeath

Fires when an Entity is killed

Example usage:

-- Give players 10 emeralds when they eliminate another player
Events.EntityDeath(function(event)
    -- Only give payout if this is a player entity
    if (event.entity:getPlayer() == nil) then
        return
    end
    
    -- Only give payout if this is an elimination
    if not event.finalKill then
        return
    end

    -- Pay all assisting players 10 emeralds
    for i, entity in ipairs(event.assists) do
        if not entity:getPlayer() then
            continue
        end
        
        InventoryService.giveItem(entity:getPlayer(), ItemType.EMERALD, 10, true)
    end
end)

Parameters

entity: Entity

The killed entity.

killer: Entity | nil

The killer (or nil if not killed by anyone).

assists: Entity[]

List of entities who damaged the victim within the last 15s.

finalKill: bool

True if the killed entity is going to be eliminated after this kill.

Last updated