Hello fellow scripters, been a while. Ignore the title, it make no sense. I know. Anyway, what I want to do is simple. According to my knowledge when you require a module script, what ever the module script return get stored into a variable and only get loaded up one time. So if you try to require the same module, what ever it returned the first time will get returned the second time. Correct?
Well, if this being the case.Why can't I do this? It act as an infinity recursive loop.
Module A
local ModuleB = require(ModuleB)
ModuleB
local ModuleA = require(ModuleA)
Server
local ModuleA = require(ModuleA)
This isn't exactly how my code is, but it gives you the basic idea. Why can't I require a module script like this?
-Kurieita
This is happening because you're requiring the first module script, which requires the second. Afterwards, the second module script requires the first one, before it has finished loading. A module script can't be cached if it hasn't finished loading, therefore you can't require a module script to cause a recursion.