I have some code which will only run if a value (IntValue) is 1 (1 = true).
It works great if I change the value before running the script, script finds value, runs accordingly, all good. The thing is, I'm trying to change the value of my variable through a controller in a different script.
gameRunning = game.Workspace.gameModel.gameRunning.Value
function touched()
gameRunning = 0
print("game stopped")
end
script.Parent.Touched:connect(touched)
The gameRunning is the value I am talking about.
Then, the other script searches for the value when it is called. The controller is working fine, and to my knowledge it is telling the value to change it's value to 0. The thing is, nothing changes on the side of the code below. It still runs regardless if it's been changed in-game.
local brick = script.Parent
local i = 1
gameRunning = game.Workspace.gameModel.gameRunning.Value
if brick.isAlive.Value == 1 and gameRunning == 1 then
function touched()
while i < 50 do
wait()
brick.Transparency = i / 50
i = i + 1
end
brick.CanCollide = false;
brick.isAlive.Value = 0
end
script.Parent.Touched:connect(touched)
else
print("Game not running")
end
Ideas? Could it be because my script isn't actually changing the value? Or is it that my controlled part is basing the value off the one the server originally loaded.
