Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Does a Script wait until a Module Function is finished?

I'm coding a Mode system for a Round based game, But I got a question if the script waits until the module function is finished and then it will continue? If you know please answer, I'll accept your answer if it works, Thank you! -MattVSNNL

1 answer

Hiya,

After conducting experiments, to call module scripts and adding wait() functions into the scripts I have an answer!

Calling a function from a module function, an example I created here:

local module = {}

function module:wait()
	wait(4)
end

return module

using this code:

local x = tick() require(game.Workspace.wait):wait() print(x - tick() .. " second(s) difference while calling function!")

It waited 4 seconds, then printed

-4.0098099708557 second(s) difference while calling function!

So to answer your question, the script will continue running after the module function has finished running.

Any questions? Don't be afraid to comment, I won't bite! (????)?

2 comments

0

Didn't work

0

What do you mean it "Didn't work"? You wanted to know if the rest of the script will continue after the module function has completed, and I have told you "the script will continue running after the module function has finished running."

This discussion is preserved as it was. New answers, comments, and votes are closed.