Skip to content

Element events Death

Jérôme Leclercq edited this page Dec 8, 2020 · 3 revisions

Element event:Death

Description:

Called whenever this element is about to die (after its health fell to zero).

Parameters:

  1. self: Triggered entity.
  2. attacker: The entity that caused the damage.

Remarks:

  1. The HealthUpdate event is always triggered before this event, and the Died event is always triggered after this event.
  2. This event is only called for entities with life.
  3. This is the last event in which you can prevent the entity to die by updating its health.
  4. The HealthUpdate => Death => Die event chain is only triggered if the entity death has been validated by the server. This means that if you resurrect the entity in the Death event server-side, only a HealthUpdate event will be generated client-side.

Example code:

entity:On("Death", function (self)
	print("I'm dying")
end)
Clone this wiki locally