Revision Difference
Entity:Remove#565630
<function name="Remove" parent="Entity" type="classfunc">
<description>Removes the entity it is used on. The entity will be removed at the start of next tick.</description>⤶
<realm>Shared</realm>⤶
<realm>Shared</realm> ⤶
<description>⤶
Removes (or deletes) a given <page>Entity</page>. ⤶
⤶
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 <page>ENTITY:IsMarkedForDeletion</page>⤶
</description>⤶
</function>
<example>
<description></description>⤶
<code>ents.FindByClass( "prop_physics" )[1]:Remove()</code>⤶
<output>Removes whichever prop is first found or errors if no entity was found.</output>⤶
⤶
</example> <description>⤶
Removes the Entity being looked at by the first <page>Player</page> to join the server.⤶
</description>⤶
<code>⤶
local firstPlayer = player.GetAll()[1]⤶
local targetEntity = firstPlayer:GetEyeTrace().Entity⤶
⤶
if IsValid( targetEntity ) then⤶
targetEntity:Remove()⤶
end⤶
</code>⤶
</example>
Garry's Mod
Rust
Steamworks
Wiki Help