EntityDeath
Fires when an Entity is killed
-- 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
killer: Entity | nil
assists: Entity[]
finalKill: bool
Last updated