The "if-then" statement in my script keeps working while it's supposed to not work?
Asked by
3 years ago Edited 3 years ago
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.)
01 | local random = math.random( 5 , 30 ) |
04 | if game.Workspace.OxGenIsOnAction.Value = = false then |
06 | game.Workspace.OxGenSound.Broken:Play() |
07 | game.Workspace.OxGenSound.Running:Stop() |
08 | game.Workspace.OxGenErrorL.Script.Disabled = false |
10 | if game.Workspace.OxGenRestartComplete.Value = = false then |
11 | for _,v in pairs (game.Players:GetPlayers()) do |
12 | v:Kick( "You're failed to restart the Oxygen Generator and died by low oxygen. Please rejoin to regenerate." ) |
16 | until game.Workspace.DisasterHappened.Value = = true |