I know when you have a modulescript, it will always return the same value whenever it is required.
However, what if you accidentally have a duplicate of that exact modulescript and require it (meaning 2 same modulescripts getting different requires) will Luau recognize this and ignore the copy?
For instance:
local sydneyOne = require(game.Workspace.Sydney)
local sydneyAcciddentalDupe = require(game.Workspace.SydneyDupe)
It will return a reference to the previously loaded module, making sure that both the original and duplicate references point to the same module object. Xx
Actually ROBLOX did execute a duplicate module when I tried it. I have a TopBar+ module and in that module, I have a duplicate of the Promise library which I am already using. I wonder what happened to it since I am using two copies of the same module??? Does the exact copy get ignored?
When you accidentally (or not x) have two copies of the same module script and require both of them, the second copy will not be reloaded or executed. Lua recognizes that the module has already been loaded and executed, so it will return a reference to the same module object that was returned by the first require call. Essentially, the second copy is ignored, and both references will point to the original module object.