Garry's Mod Wiki

Entity:Remove

  Entity:Remove()

Description

Removes (or deletes) a given Entity. Does nothing when called on Player or game.GetWorld entity

The entity will continue to exist until the start of the next tick. To check if an entity will be removed in the next tick, see Entity:IsMarkedForDeletion

Example

Removes the Entity being looked at by the first Player to join the server.

local firstPlayer = player.GetAll()[1] local targetEntity = firstPlayer:GetEyeTrace().Entity if IsValid( targetEntity ) then targetEntity:Remove() end