Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When changing the boolvalue game round won't end?

Asked by 8 years ago

I have this part of my game script when the bool value turns true then the game should stop but then when I change it to true in server storage when testing it in studio the round will not end. Can you help?

    for _,player in pairs(Game.Players:GetChildren()) do
                local Gui = player.PlayerGui.Gui
                Gui.Label.Text = LocationMsg
                repeat
                    wait(1)
                   GameTime = GameTime - 1
                     Gui.Label.Text = "Game time: "..GameTime

                  until  GameTime  == 0 or IsBombDisarmed == true
                  if IsBombDisarmed == true then
                     Gui.Label.Text = WinMsg
                     for _, player in pairs(Game.Players:GetChildren()) do
                        local Gui = player.PlayerGui.Gui
                        Gui.Label.Text = WinMsg
                        player.leaderstats.Credits.Value = player.leaderstats.Credits.Value + WinningAmount
                        wait(2)
                        GameTime = RestoreGameTimeAmmount
                        break
                        end
                   elseif GameTime == 0 then

                        for _, player in pairs(Game.Players:GetChildren()) do
                        local Gui = player.PlayerGui.Gui
                        Gui.TextLabel.Text = LoseMsg
                        wait(2)
                        GameTime = RestoreGameTimeAmmount
                        break

                        end
                    end
                end      
            end  
        end
0
Maybe try putting it in a loop, like a repeat until the value is turned to true NinjoOnline 1146 — 8y

1 answer

Log in to vote
1
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

IsBombDisarmed will not change value unless an event connected to the BoolValue itself redefines the variable. The more straightforward thing to do would be to just read the value.

0
IsBombDisarmed is not the value, it is a variable set to the value of the value and it is set once. IsBombDisarmed does not change. 1waffle1 2908 — 8y
0
Thanks I didn't realize that I didn't have .Value. docrobloxman52 407 — 8y
Ad

Answer this question