I'm trying to change a variable's value in a script that only appears when the game starts, so I'll have to do that from another but I don't know how
COMMUNITY QUESTION
How do you change a variable's value in a script by using another script?
1 answer
You can use the _G, which is a table shared by all scripts. Usage:
script1:
wait(5);
_G.variablesValue = 10;
script2;
repeat wait() until _G.variablesValue == 10
print("yuht");
Notes..
- _G is shared between Scripts
- _G is shared between LocalScripts
- _G is not shared between Scripts and LocalScripts
- _G is not shared between mutliple clients' LocalScripts
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Could you explain this a bit more? I guess if you want to affect the script's code you could use a ModuleScript, but this is based on a guess considering I don't know what it is you want exactly!
You can also make a value in ReplicatedStorage or ServerStorage that both scripts can watch and/or update