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

My script isnt working because "else" doesnt work can somebody help me?

Asked by 7 years ago

I put a then so when the players amount is less than two the game wont start but it doesnt work can somebody look at it?

01while true do
02     if game.Players.NumPlayers > 1 then
03        h.Text = "Intermission"
04        wait(1)
05        h.Text = "The game will start soon.."
06        wait(1)
07        for i = 3, 1, -1 do
08            h.Text = "Time left: " .. i
09            wait(1)
10        end
11        h.Text = "Game ended!"
12        wait(3)
13        if RedVal > BlueVal then
14            h.Text = "The winner is TeamRed"
15            aa:Play()
View all 36 lines...
0
Your "else" is outside of one of your "if" statments IAmKingMatt -8 — 7y
0
else is outside of the if loop you need it inside of the while true do loop and before the if statement is ended Vulkarin 581 — 7y

2 answers

Log in to vote
0
Answered by
dirk2999 103
7 years ago

You need to remove 2 'end's from above the else, and put one more below and you should be fine.

01while true do
02     if game.Players.NumPlayers > 1 then
03        h.Text = "Intermission"
04        wait(1)
05        h.Text = "The game will start soon.."
06        wait(1)
07        for i = 3, 1, -1 do
08            h.Text = "Time left: " .. i
09            wait(1)
10        end
11        h.Text = "Game ended!"
12        wait(3)
13        if RedVal > BlueVal then
14            h.Text = "The winner is TeamRed"
15            aa:Play()
View all 35 lines...
0
Incorrect, since the `else` statement is outside a conditional statement. oSyM8V3N 429 — 7y
0
Actually it's not if you look at it. dirk2999 103 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

els has to be before one of the ends. It has to be in the script

Answer this question