Maris Posted August 18, 2014 Share Posted August 18, 2014 Is it right?local function UpdateMe(inst) -- Do something -- ... inst:DoTaskInTime(1, function() UpdateMe(inst) end)end Link to comment Share on other sites More sharing options...
plaidman Posted August 18, 2014 Share Posted August 18, 2014 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() Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.