Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is it possible to have one script with all my locals that would apply to multiple scripts?

I have a script that modifies the health of all my divisions. The issue is, they are all in folders, and I have them in there to organize it. It would be much easier if I could have one script with all my locals, and just modify it from there, so I can just make the values of the variables that go across all the scripts.

1 answer

✓ Accepted answer

In a Server Script you can use Global Values to transfer objects between scripts,

Example:

Script 1:

_G.P = workspace.Part

Script 2

print(_G.P.Name) -- prints the part name "Part"

However, in LocalScripts you need to use RemoteEvents !

Learn about them Here: Click

( You could use Remote Events to make global values to other scripts or just make a script from the Data from the RemoteEvent arguments )

2 comments

0

_G. defines the value, after that it's the define / name of it. Value of it doesn't really matter!

0

Alright, thanks, i'll test it out.

This discussion is preserved as it was. New answers, comments, and votes are closed.