DestroyEntity
Removes an entity from the world, for everyone.
A horse under a rider dismounts them; a pickup vanishes; an actor’s corpse is gone; a dog leaves. Anything a mode created is also removed by a reload.
A horse in a running pull-down (IsPlayerInPullDown) is not removed at once - the game’s pair is playing on it on the
players’ screens: it is destroyed when the pull-down ends, about six and a half seconds after it started, and the call
returns true meanwhile with the horse still there.
A body somebody carries, or an actor that carries one (GetEntityCarrier), ends the carry first: every screen lets go at
once and OnPlayerCarryEnd hears "destroyed" - then the entity goes. A dead player’s corpse is an entity: it goes with its corpse.
Syntax
Section titled “Syntax”DestroyEntity(id)| Parameter | Type | |
|---|---|---|
id |
number | the entity |
Returns
Section titled “Returns”boolean - false when there is no such entity
Example
Section titled “Example”SetTimer(function() DestroyEntity(corpse) end, 20000)See also
Section titled “See also”GetEntities · CreatePickup · CreateHorse · the World entities group of the index
