In one script I have this code:
_G["chick"] = function() print("chicken") end
And in another script I have this code that activates on tool click:
_G.chick()
But I get this message: attempt to call field 'chick' (a nil value)
Even with the command line I get the same message.
How should I do this? I can tell my code will be terrible if I have to copypaste through every tool.
The globals table for client-side and server-side scripts is completely different, meaning that you can't create a global variable (or function) in a server-side script and use it from a client-side script (the same applies in the opposite example).
Why not use a ModuleScript?