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

Can someone help me out? - Expected <eof>, got 'else'

Asked by 4 years ago

Im new to coding so i dont know what ive done wrong i'd really appreciate it if someone could help me out VVVVVV

Status.Value = "Get Ready To Play"

wait(2)

for i = Gamelength,0,-1 do

    for x, player in pairs(plrs) do

        character = player.Character

        if not character then
            -- left the game
            table.remove(plrs,x)

            else
            end
                if character:FindFirstChild("GameTag")
                then
                    -- They are still alive
                    print(player.Name.." is still in the game!")
                else
                        -- they ded
                        table.remove(plrs,x)


                end
        end
    end
    else
        table.remove(plrs,x)
        print(player.Name.." has been removed!")

    end

    Status.Value = "There are "..i.." seconds remaining, and "..#plrs.." players left"
    if #plrs == 1 then
        -- last person alive
        Status.Value = "The winner is "..plrs(1).Name
        plrs[1].leaderstats.Gold.Value = plrs[1].leaderstats.Gold.Value + reward
        break

        elseif #plrs == 0 then
            Status.Value = "Nobody won!"
            break
        elseif i == 0 then
                Status.Value ="Time up"
0
Which line? kingblaze_1000 359 — 4y
0
Make sure to properly indent your code kingblaze_1000 359 — 4y
0
Its line 21 the else has a red underline CR7Lazric 2 — 4y
0
You don't need else on line 15 and click backspace once on line 16 before the end because that is ending the if statement before kingblaze_1000 359 — 4y
View all comments (3 more)
0
I pasted the script and i got a error at line 28, the problem is you got 2 else or you are missing an if statement Nguyenlegiahung 1091 — 4y
0
I'm sorry I tried writing an answer but i don't understand the script. I don't get what your trying to do with all the if statements and else. Maybe on line 15 you're looking for elseif statement and if you are then you can remove the end on line 16 kingblaze_1000 359 — 4y
0
On line 28 i don't think you need the else statement, they only come with if statements and you haven't got an if statement for that else statement kingblaze_1000 359 — 4y

1 answer

Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
4 years ago

They are a few things wrong with your code. The first thing is that you added to else statements on line 21 and line 15. Your only supposed to have one else or one elseif. Second you don't need an end on line 33. 3. You can only have a break only when you have a loop like a return loop

Ad

Answer this question