Attached is a .rbxl file of a bug I accidentally came across while scripting ModuleScript business. To cut to the chase, I’ll walk you through the process of encountering a bug.
In ReplicatedStorage, there is a ModuleScript, Test, with another ModuleScript, Another, inside of Test. Test requires Another, with require(script.Another) with emphasis on the script variable. Upon doing so, however, I realize that the entire environment for Another is dumped into Test. The script variable in Test now refers to Another, and all variables in Another get dumped into Test. I proved this in the attached file.
The script variable changes regardless of if Test is being required in a server or local script. However, for the variables to actually transfer, you must require Test via command bar.
The script variable refers to: Test
The script variable now refers to: Another
Made sure I was using the most up-to-date version of studio, and I am unable to require modules present in the game (not required from the site) through the command bar. Since the module is present in the game, there shouldn’t be any trust check issues requiring it.