Alright, so I've been looking for the answer to this question for a while, but never found it. What I want to do is have all my Functions and Variables in one script then be able to call then in a different script.
For example:
_G.BaseScriptName.GlobalFunction = function(Args) -- CODE HERE end
Then I want to be able to call it in a different script like:
_G.BaseScriptName.GlobalFunction(Args)
Basicly the problem is when I call it, it gives this error:
Workspace.Script:3: attempt to call field 'GlobalFunction' (a nil value)
Any help is appreciated :D
in script one you had
_G.BaseScriptName.GlobalFunction = function(Args) -- CODE HERE end
make it have this at the top it will fix it. _G.BaseScriptName = {}
_G.BaseScriptName = {} _G.BaseScriptName.GlobalFunction = function(Args) -- CODE HERE end
It is simply a index, but you never created the house to the door in other words.#
If I helped upvote my answer .
I have the _G.BaseScriptName = {} table, but the function only works in the base script itself and the command line in studio.
Im obviously missing something VERY essential
I didnt really make myself clear, This is what I have:
_G.BaseScript = {} _G.BaseScript.OutputLine = function(Line) print(Line) end