Garry's Mod Wiki

Revision Difference

ENTITY:Touch#527668

<function name="Touch" parent="ENTITY" type="hook"> <ishook>yes</ishook> <description> Called every tick for every entity being "touched". See also <page>ENTITY:StartTouch</page> and <page>ENTITY:EndTouch</page>. ⤶ <warning>This only works for **brush** entities and for entities that have <page>Entity:SetTrigger</page> set to true.</warning>⤶ <note>For physics enabled entities, this hook will **not** be ran while the entity's physics is asleep. See <page>PhysObj:Wake</page>.</note> </description> <realm>Server</realm> <predicted>No</predicted> <args> <arg name="entity" type="Entity">The entity that touched it.</arg> </args> </function> <example> <code> function ENTITY:Touch(entity) self:EmitSound("ambient/explosions/explode_" .. math.random(1, 9) .. ".wav") self:Remove() end </code> </example>