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

Workspace.MainScript:152: 'end' expected (to close 'for' at line 38) near '<eof>'?

Asked by 5 years ago
maps = {"Dodge the Doges"}

Positions = {}
Winners = {}
local Players = game:GetService('Players')
local ReplicatedStoragge = game:GetService('ReplicatedStorage')

intermission = 1
timebeforeroundstarts = 5
dodgethedogeswait = 6

    function m(update)

    local c = game.Players:GetChildren()

    for i=1, #c do
        c[i].PlayerGui.InformationGui.loltext.Text = "" .. update
    end
end


local Remotes = ReplicatedStoragge:WaitForChild('Remotes')
    local CountDown = Remotes:WaitForChild('Countdown')
function FindIndex(Table,Val)
    for index,v in pairs(Table) do
        if v == Val then
            return index
        end
    end
end




while true do

    local text = "Waiting for players....."
    for i = 1, #text do
    wait(.05)
    script.Parent.VD.Text = string.sub(text, 1, i)

    if #Players:GetPlayers() >= 5 then


        wait(1)
    for i=1, intermission do
        m("Intermission: " .. intermission - i)

        end



    gtl = game.Players:GetChildren()

    for i=1, #gtl do
        gtl[i].Playing.Value = true
    end


    mapnum = #maps
    map = maps[mapnum]
    game.Lighting[map]:Clone().Parent = workspace

    m("Game Starting...")

    wait(3)






    m("Game Starting...")
    wait(2)

    for i=1, timebeforeroundstarts do
        m("The game will start in: " .. timebeforeroundstarts -i)
        wait(1)
    end



    getall = game.Players:GetChildren()


    getspawns = game.Workspace[map].Spawns:GetChildren()




    for i=1, #getall do
        if getall[i].Playing.Value == true then
        curspawn = game.Workspace[map].Spawns.Spawn
        getall[i].Character.Torso.CFrame = CFrame.new(curspawn.Position)
        curspawn:remove()
        end


    end



    if map=="Dodge the Doges" then


        for i=1, dodgethedogeswait do
            m("The game will end In: " .. dodgethedogeswait -i)
            wait(1)
        end






    end



    getllas = game.Players:GetChildren()

    for i=1, #getllas do
    if getllas[i]:FindFirstChild("leaderstats") then
        if getllas[i].Playing.Value == true then
            getllas[i].leaderstats.Wins.Value = getllas[i].leaderstats.Wins.Value + 1
            getllas[i].leaderstats.Points.Value = getllas[i].leaderstats.Points.Value + 10
            table.insert(Winners, getllas[i].Name)
        end

    end

    end

    if #Winners == 0 then
    m("Nobody Won!")
else
    m(table.concat(Winners, ", ").." Has won!")
    end


game.Workspace[map]:remove()
for i=1, #Winners do
    table.remove(Winners, 1)
end







end

2 answers

Log in to vote
0
Answered by 5 years ago

The problem is you have a for loop at line 38

for i = 1, #text do

that's never closed. If I had to guess you'd want to add an end to line 41, right after 40.

for i = 1, #text do
wait(.05)
script.Parent.VD.Text = string.sub(text, 1, i)
--adding end here
end
--yep added
if #Players:GetPlayers() >= 5 then

If you need more help just ask! :D

0
lmao ty LiLFriks 39 — 5y
Ad
Log in to vote
0
Answered by
fredfishy 833 Moderation Voter
5 years ago

It's pretty much telling you exactly what the issue is here.

Workspace.MainScript:152: 'end' expected (to close 'for' at line 38) near '<eof>'?

It expects another end after line 152 and between <eof>, meaning "end of file".

So basically it's saying it didn't expect your script to stop, and it's waiting for something to close.

It also says it's from the for at line 38 never being closed. Whether or not that part is accurate I can't really tell because your script indentation is all over the place.

Fix your script's indentation, and the issue will probably become really obvious.

Answer this question