Basically, If I have a variable defined in a ModuleScript, can any ModuleScripts under that read/write variables from it's parent?
ModuleScript1>ModuleScript2
Like, for example, If I have ModuleScript1 define this:
Variable = true
Can ModuleScript2 do this?
Variable = false
My script is more complicated than this, so this honestly might work. Idk, because I cant really test this. I'm sure it's possible, but I cant figure out how. Ik global functions are a thing, but are global variables a thing? I've tried doing 'require(script.Parent)' , but that doesn't seem to work. I've tried a few things, but so far nothin.
If you know a way to do this, I would really appreciate it if you'd let me know. Thanks! :)
NOTE: I have indeed read the wiki article on ModuleScripts. So, yea. Also, if anything here needs clarifying, lemme know. :)
I highly suggest against using Global variables. They're useful, but bad practice.
Instead, make the variable a member of the Table you're returning.
module = {} module.Variable = true return module
Then the Script that requires this module can set the Variable using <moduleVar>.Variable
.