Garry's Mod Wiki

Revision Difference

Entity:NextThink#526502

<function name="NextThink" parent="Entity" type="classfunc"> <description> In the case of a scripted entity, this will cause the next <page>ENTITY:Think</page> event to be run at the given time. ⤶ Does not work clientside! Use <page>Entity:SetNextClientThink</page> instead.⤶ <bug issue="3269">This does not work with SWEPs or Nextbots.</bug> </description> <realm>Shared</realm> <args> <arg name="timestamp" type="number">The relative to <page>Global.CurTime</page> timestamp, at which the next think should occur.</arg> </args> </function> <example> <description>Prints 'Hello, World!' in console and sleeps for a second.</description> <code> function ENT:Think() print("Hello, World!") self:NextThink( CurTime() + 1 ) return true -- Note: You need to return true to override the default next think time end </code> <output>Hello, World! every second the entity exists in the world.</output> </example>