Currently to require a module, you need to do require(modulePath)
, eg require(game:GetService("ReplicatedStorage"):WaitForChild("MyModule"))
. Typing that at the top of every script is a pain, looks messy and nobody likes it
Adding a new property to ModuleScripts, ModuleScript.ReferenceBy
could help solve this. Calling require()
and passing a string would find a ModuleScript with the same ReferenceBy property and require it. If a module doesn’t exist with that reference, it could either return nil or wait for a module to exist with that reference (this would be the case on the client before the module gets replicated)
require("MyModule")
is much better than require(game:GetService("ReplicatedStorage"):WaitForChild("MyModule"))