Code in modules are same as if the code was in your script in where you’re requiring and running modules functions, so when there is a loop or wait time, the script do not continue until it is finished.
And yeah, using task.spawn should be fine for it… you can also use a tween instead of repeat until, it does the same and do not make your code stuck