Task-scheduler friendly delay and Debris:AddItem - no more fear for delays!

Hello all!
I’m sure many of you have seen my post about Roblox’s wait function clogging up the task scheduler very easily - today I’ll be expanding the range of task-scheduler friendly functions, from just a custom wait to other methods such as FastDelay, FastDebris and more to come (post any suggestions you got)!

The code is very short, and everything I’d like to point out regarding Roblox’s task scheduler has already been done on my custom wait function thread.


Source


Dependencies you must have for this:


Current functions optimized:

  • delayFastDelay
  • Debris::AddItemFastDebris

Function behavior:

  • FastDelay:
    • Parameters: number delayTime, function callback, tuple params
    • Callback parameters: number yieldTime, number timePassed, tuple params
    • Return: void
  • FastDebris:
    • Parameters: Instance Item, number Lifetime
    • Return: void

Example code:

  • FastDelay:
FastDelay(1, function(Message)
    print('Message from the past:', Message) -- Message from the past: Hello!
end, 'Hello!')
  • FastDebris:
FastDebris(workspace.Part, 1)

Possible issues:

Running any of the functions right after initiating a game can lead to inaccurate results. Use with caution!

10 Likes

Looks cool, will have to check this out when I start developing my gun system.

1 Like