ModuleScripts: How do they work?
I've read the wiki about ModuleScripts, but it isn't making sense. I mean, do ModuleScripts have to be stored in Workplace or ServerScriptService? (cause the examples are in the Workspace) To me, it reminds of Java and importing libraries.
Is there is difference to it with using Global Functions? And when it states that ModuleScripts will only run once, does that mean:
- it can no longer be used by any other function again, until the process is complete?
- it can't be used by any other script after it is called?
Also, limitations to ServerScripts and LocalScripts accessing ModuleScripts? (No examples of ModuleScripts being using in Roblox Wiki)
1 | local printModule = require(game.Workspace.MyModuleScript) |
3 | printModule( "Test Print" ) |
4 | printModule( "Test Print" ) |
5 | printModule( "Test Print" ) |
Something like this, for example can be called?