Waiting for a function in a modulescript to finish

Hi all,
I was wondering if there was some way to wait for a function in a ModuleScript to be finished.

Basically I have a function in my ModuleScript that moves the player and waits for them to get to the specified position. If they don’t make it in (distance/speed) seconds, I CFrame their humanoid root part to the position.

This function is called from a server script and if I could make it wait until the module script checked the position it’d be glorious.

I understand that I don’t really need a ModuleScript for this, but since I’m gonna be using this function a lot I rather practice a bit with them.

I recommend making it a recursive function (a return at the end) that returns a bool or something and call the function doing

local callFunc = module.func()
2 Likes

I don’t know why I thought module scripts couldn’t return values haha
Thanks for the help :smiley: