I was trying to add abilitys to my charater using Module scripts but i need the main script to wait for the module to end but its finishes before even starting the function
– Screen shot of the console
I tried looking but couldn’t find anything
I was trying to add abilitys to my charater using Module scripts but i need the main script to wait for the module to end but its finishes before even starting the function
– Screen shot of the console
I tried looking but couldn’t find anything
In this case, you would need to return the ModuleScript’s function within the ModuleScript, and call it within the Script. Here is what I mean
ModuleScript
return function(args)
wait(10)
print(“Used”)
wait(2)
end
Script
require(ModuleScript)()
print(“Done”)
This will call/execute the ModuleScript’s content within the script itself, yielding the rest of the script.
Let me know how this works!
Module code is still synchronised so subsequent code will run after calling a function from the module. If you’re really that concerned and it’s appropriate then you could also adopt an event-driven system so that your subsequent code will execute as in when it’s signaled to do so.