I’d like to know if there are any issues with this type of usage, this is a very simplified example, in practice it’d be much more intensive than this:
Script in ServerScriptService, lets call it “GameScript”
ModuleScript in ServerScriptService, lets call it “AllFuncsScript”
--GameScript:
_G.AllFuncs = require(AllFuncsScript)
--AllFuncsScript:
Module = {}
Module.HelloWorld function()
print("Hello World!")
end)
return Module
--Player Character Server Script:
_G.AllFuncs.HelloWorld()
Essentially my inquiry is if doing it in that method would be bad practice if say, 20 Players were to be able to access that one require(). Would it be better to just use _G. directly and skip the ModuleScript aspect? Please elaborate deeply as this confuses me and it’s a part of core infrastructure in a game. (It’s very important to me to understand.)
TL;DR: Use _G.V = require(ModuleScript) ModuleScript that contains universal functions that I’d use repetitively
OR use _G.V = {} – Dictionary of all functions, essentially what I’d use the ModuleScript for in the first place.
OR any better options?