Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a variable that spans across multiple scripts?

Asked by 5 years ago
01local Cool = true
02 
03while Cool == true do
04        game.ServerStorage.Value.Value = false
05wait(3)
06    print(game.ServerStorage.Value.Value)
07        game.ServerStorage.Value.Value = true
08wait(3)
09    print(game.ServerStorage.Value.Value)
10end

This is my code that i am just using for testing loops and BoolValues.

The while loop I made functions completely fine, although I want to change the value of Cool (The variable) to false.

I want to know if there is any way to change the values of a variable from another script, and if so , how.

1 answer

Log in to vote
0
Answered by
DesertusX 435 Moderation Voter
5 years ago

You will need Global Variables for this. This is an example of use:

1_G.Variable = "String"

And in another script, you could write.

1print(_G.Variable)

Which would print "String".

I'm sorry if my explanation wasn't that clear.

There are a lot more explanations about _G on this site.

0
This seems simple let me try. saulty11 17 — 5y
Ad

Answer this question