Im starting to learn how to use _G and I've tried to use it as a variable sharer between scripts, but it doesn't seem that there is a possible way to do so. If there is another method I could use, please tell me, I'm always looking for better ways to improve my scripting capabilities.
COMMUNITY QUESTION
How do I share variables between scripts, possibly using _G?
2 answers
Module script~
local module = {}
function module.variable()
["Variable"] = "something"
end
return module
From the server/client
local moduleScript = require(game:GetService("ServerScriptService").ModuleScript)
print(moduleScript.Variable)
i might be wrong
1 comment
0
This would print nil.
Have you tried using the value instances (BoolValue, IntValue, NumberValue, StringValue, Vector3Value, etc.)? Just set the value objects value then read it from another script.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Module scripts
that doesn't tell me much
learn about them or stick with _G