#what does using require(ModuleScript) do exactly?

1 messages · Page 1 of 1 (latest)

ionic crag
#

I wanna know if scripts that use the same modulescript duplicate the modulescript and use the functions within it as their own thread(therefor you can't use global variables that can all be viewed from different scripts requiring the same modulescript) vs the module script runs all requires of the script(both server and local independently ofc)

#

Ex:
There is a Module1,Script1,Script2

Script1 and Script2 require Module1

Module1 has a boolean instantiated as false

Script1 changes the boolean to true

Script2 prints out the boolean

What would it print out

#

i know this is a basic and testable example but in the case of big projects there may be some details i don't know that someone could tell me about

gilded moat
#

i could be wrong but

#

module scripts are more or less js tables, so as long as both the scripts are running in the same context script 2 will print true

turbid mesa
ionic crag
#

ok ty