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

How to make a variable that spans across multiple scripts?

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

✓ Accepted answer

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.

1 comment

0

This seems simple let me try.

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