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

Help with for loop?

Asked by 10 years ago
while true do
    for i = 10, 1, -1 do
        print(i)
        wait(1)
    end
    if game.Workspace.Values.BlueScore.Value > game.Workspace.Values.RedScore.Value then
        game.StarterGui.MainHeader.Winner.Visible = true
        game.StarterGui.MainHeader.Winner.Text = "Blue has won the game by: " .. game.Workspace.Values.BlueScore.Value - game.Workspace.Values.RedScore.Value .. " kills"
        game.StarterGui.MainHeader.Winner.TextStrokeColor3 = Color3.new(0,0,1)      
        wait(2)     
        game.StarterGui.MainHeader.Winner.Text = "The game is restarting"   
        game.Workspace.Values.BlueScore.Value = 0
        game.Workspace.Values.RedScore.Value = 0
        wait(1)
        game.StarterGui.MainHeader.Winner.Visible = false
    else 
        print("Not working")
    end
end

Why dosent this work? It prints i but once it gets to 1 it dosent go to the if statement.

0
I'm guessing because it's because you if statement returns false, add an else with a print to check. SirNoobly 165 — 10y
0
Still not working NinjoOnline 1146 — 10y

Answer this question