Does roblox allow modules to be able to require other modules? Like...
-- MainModule local Module 2 = require(###########)
-- Module 2 local Module 2 = require (###########)
^^^Does this work on roblox and is this allowed in scripts?
Yes, ModuleScripts are allowed to require
other ModuleScripts. In fact, with more complex games, it is good practice to have sub-dependencies (with a hierarchical structure) rather than a flat structure. So for example, your modules could be like this:
GameModule -> GunModule -> BulletManagerModule -> MapModule -> VotingModule
One thing that is not allowed is for ModuleScript loading to cause a cycle. That is, a ModuleScript A can't require a ModuleScript B so that it ModuleScript A gets required again before it has returned a value. For example, this is not allowed:
local self_module = require(script) return { self_module = self_module }
This is because requiring this module would cause the module to get required again infinitely many times.
However, this is allowed:
return { get_self_module = function() return require(script) end }
The latter is allowed, because the require() can only run after the module has fully loaded (and returned a value).