How to not wait until module script is done with function?

I have a function in a ServerScriptService script which fires a module script function, but for some reason my server script function waits until the module script is done with its funciton, and then continues with its own function.

This is a problem because my module function has a wait() in it, so my server script basicly just waits for multiple seconds until continuing.

Is there a way around this?

You can use Spawns or Couroutines. Spawns and Couroutines create a new thread so that the rest of the code won’t have to wait for the function to be completed:

spawn(function()
     --call module function here
end)
--code that you don't want to be delayed goes here
6 Likes