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

How can I call mutliple Module Functions at once?

Hello there, I tried calling multiple module functions at once and it only plays one at a time, here is a snippet.

wait(3)
local module = require(script.Parent.ModuleScript)
module:TransitionScreenFade()
module:TransitionTextFade()

I even tried this

wait(3)
local module = require(script.Parent.ModuleScript)
module:TransitionScreenFade() module:TransitionTextFade()

Still doesn't work, is it even possible to call multiple via lua?

(I use java script a lot so I'm not too familiar with lua)

1 answer

✓ Accepted answer

JavaScript, like all other programming languages, is synchronous. When executing a function that can yield, the primary thread will be held.

You're wishing to call these functions in an asynchronous fashion, meaning you need to use Threading. Fortunately, the ROBLOX engine provides a function that can interact with the task-schedular directly, eliminating the manual labour: spawn(callback).

spawn(module.TransitionScreenFade)
spawn(module.TransitionTextFade)

1 comment

0

Thank you very much, this is most informative and helpful, have a great day!

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