Currently, I have a script with a couple of coroutines with while loops that are supposed to be only active when GAME_ACTIVE = true.
local GAME_ACTIVE = true
coroutine.resume(coroutine.create(function()
while GAME_ACTIVE = true do
-- do stuff here
end
end))
coroutine.resume(coroutine.create(function()
while GAME_ACTIVE == true do
if condtion > 0 then
local GAME_ACTIVE == false
end
end))
Here’s a shorter version of my code without all the filler.
When the condition is met then it will print out GAME_ACTIVE = false in the second coroutine. However none of the loops ever end.
I used a timer to go off after the “if condition > 0 then” is met in the other coroutine and it still showed as local GAME_ACTIVE = true.
How can I get the variable to update across the whole script?