# EntityDeath

Example usage:

<pre class="language-lua"><code class="lang-lua"><strong>-- Give players 10 emeralds when they eliminate another player
</strong><strong>Events.EntityDeath(function(event)
</strong>    -- 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)
</code></pre>

### Parameters

#### entity: [Entity](/scripting/bedwars-scripting/objects/entity.md)

The killed entity.

#### killer: [Entity](/scripting/bedwars-scripting/objects/entity.md) | nil

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

#### assists: [Entity](/scripting/bedwars-scripting/objects/entity.md)\[]

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.easy.gg/scripting/bedwars-scripting/events/entitydeath.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
