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

Confused on expected end? 'end' expected (to close 'while' at line 26) near 'else'

Asked by 6 years ago

I was about finshed making a playable verison of my minigames but the next day i see that its no longer working.

``minigames = game.Lighting.Minigames:GetChildren()

h = Instance.new("Hint", game.Workspace)

local players = game:GetService("Players")

function removePlate() local plates = game.Workspace.DissapearingPlates.Plates:GetChildren() local ranNum1 = math.random(1, #plates) local ranNum2 = 1 while ranNum1 == ranNum2 do ranNum2 = math.random(1, #plates) wait() end local plateChosen = plates[ranNum1] local plateChosen2 = plates[ranNum2] for i = 0, 1, 0.05 do plateChosen.Transparency = i plateChosen2.Transparency = i wait() end plateChosen:Destroy() plateChosen2:Destroy() end

while true do

if game.Players.NumPlayers >1 then
    h.Text = "Choosing map..."
    wait(3)
    ranGame = math.random(1, #minigames)
    gameChosen = minigames[ranGame]
    h.Text = "Map chosen: " .. gameChosen.Name
    wait(3)
    gameChosenClone = gameChosen:Clone()
    gameChosenClone.Parent = game.Workspace
    wait(3)

--(THIS IS WHERE THE TELEPORTING PART BEGINS) --Teleporting people to map spawns = gameChosenClone.Spawns:GetChildren() for i, v in pairs(game.Players:GetPlayers()) do name = v.Name check = game.Workspace:FindFirstChild(name) if check then checkHumanoid = check:findFirstChild("Humanoid") if checkHumanoid then v.Character:MoveTo(spawns[i].Position) v.ingame.Value = true end end end -- THIS IS WHERE THE TELEPORTING PART ENDS for i = 3, 1, -1 do h.Text = "Game begins in " .. i wait(1) end

    if gameChosenClone.Name == "DissapearingPlates" then
        timeTillGameEnds = 20
        wait(1)
        --Countdown until the game ends
        for i = timeTillGameEnds, 1, -1 do
            h.Text = "Time Left: " .. i
            removePlate()
        end
    elseif gameChosenClone.Name == "Ghost Test" then
        timeTillGameEnds2 = 20
        game.Lighting.Pistol:Clone().parent = players.Backpack  
    end
        wait(1)
        for i = timeTillGameEnds2, 1, -1 do
            h.Text = "Time left: " .. i
        end
    -- Insert other minigame here (This row)
    end


    h.Text = "Game over!"
    wait(3)
    h.Text = "Giving points to players who won!"
    for i, v in pairs(game.Players:GetPlayers())do
        ingame = v:FindFirstChild("ingame")
        if ingame then
            if ingame.Value == true then
                v.leaderstats.Points.Value = v.leaderstats.Points.Value + 5
            end
        end
    end
    gameChosenClone:Destroy()
else
    h.Text = "Waiting for one more player..."
end
h.Text = "Intermisson..."
wait(10)

end

0
I can't read anything, can you make it all in one code block please? InstantManager 27 — 6y
0
The script is expecting an end, meaning that you need to add an end, like at the end. You need to add an end at the end of the code somewhere to close the 'while' function. Just add another end at the end of the script. InstantManager 27 — 6y

Answer this question