Jump to content

Recommended Posts

It looks like you're trying to set up a task to run every 1 second, right? Your above code will work perfectly, but there's a more direct way to set that up:

inst:DoPeriodicTask(1, function(inst)    -- Do something    -- ...end)
The DoTaskInTime function is appropriate if you want to do something once but delay it for a period of time.

DoPeriodicTask will do the task with the delay repeatedly until you cancel that task. You can store an instance of the Task like so:

inst.somethingTask = inst:DoPeriodicTask(1, function(inst)    -- Do something    -- ...end)
Then when you want to cancel the task, you can do:

inst.somethingTask:Cancel()

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...