Hello guys,
I have an oxygen generator in my game which is gets broken in random times and you go have to restart it or it'll kick everyone in the server due to "low oxygen."
So the problem is; when you restart the oxygen generator, the other script (the script when you click the "restart" button) sets the specific BoolValue to true
but somehow the "if-then" statement (which is supposed to work when the specific BoolValue is false
) still works and kicks everyone in the server even the BoolValue is set to true
already by another script.
Here's the script: (btw a small note: I'm 100% sure about the value sets to true
before the timer finishes counting (wait(60)
) but it still keeps kicking people.)
local random = math.random(5,30) repeat wait() wait(random) if game.Workspace.OxGenIsOnAction.Value==false then wait(0.5) game.Workspace.OxGenSound.Broken:Play() game.Workspace.OxGenSound.Running:Stop() game.Workspace.OxGenErrorL.Script.Disabled=false wait(60) --timer if game.Workspace.OxGenRestartComplete.Value==false then --the statement that I'm talking about. for _,v in pairs(game.Players:GetPlayers()) do v:Kick("You're failed to restart the Oxygen Generator and died by low oxygen. Please rejoin to regenerate.") end end end until game.Workspace.DisasterHappened.Value==true script.Disabled=true