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 4 years ago
local Cool = true

while Cool == true do
        game.ServerStorage.Value.Value = false
wait(3)
    print(game.ServerStorage.Value.Value)
        game.ServerStorage.Value.Value = true
wait(3)
    print(game.ServerStorage.Value.Value)
end

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
4 years ago

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

_G.Variable = "String"

And in another script, you could write.

print(_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 — 4y
Ad

Answer this question