maps = {"Dodge the Doges"}
Positions = {}
Winners = {}
local Players = game:GetService('Players')
local ReplicatedStoragge = game:GetService('ReplicatedStorage')
local text = "Waiting for players....."
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
for i = 1, #text do
wait(.05)
script.Parent.VD.Text = string.sub(text, 1, i)
end
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
✓ ANSWER ACCEPTED
[string "..."]:154: 'end' expected (to close 'while' at line 36) near ''?
1 answer
✓ Accepted answer
The reason why you are having trouble is because you did not indent your code properly.
Everytime you create a new scope, you always want to indent your code. The benefits of indenting your code include:
- Easily able to distinguish the error.
- Makes the code more readable.
Hence, I took some time and indented your code and fixed your problem. Take a good look. This is how indenting should be done and should be practiced on your other codes as well. The problem was that you had forgotten to close the while true do statement. Thus, simply adding in an another end would have had solved the trick.
Take this as a lesson as to why indenting your code is very important.
-- [Declaration Section
local maps = {"Dodge the Doges"};
local Positions = {};
local Winners = {};
local Players = game:GetService('Players');
local ReplicatedStoragge = game:GetService('ReplicatedStorage');
local text = "Waiting for players.....";
local intermission = 1;
local timebeforeroundstarts = 5;
local dodgethedogeswait = 6;
local Remotes = ReplicatedStoragge:WaitForChild('Remotes');
local CountDown = Remotes:WaitForChild('Countdown');
-- [Processing Section]
local function m(update)
local c = game.Players:GetChildren();
for i=1, #c do
c[i].PlayerGui.InformationGui.loltext.Text = "" .. update;
end;
end;
local function FindIndex(Table,Val)
for index,v in pairs(Table) do
if v == Val then
return index;
end;
end;
end;
-- [Output Section]
while true do
for i = 1, #text do
wait();
script.Parent.VD.Text = string.sub(text, 1, i);
end;
if #Players:GetPlayers() >= 5 then
wait(1);
for i=1, intermission do
m("Intermission: " .. intermission - i);
end;
local gtl = game.Players:GetChildren();
for i=1, #gtl do
gtl[i].Playing.Value = true;
end;
local mapnum = #maps;
local 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;
local getall = game.Players:GetChildren();
local 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;
local 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]:Destroy();
for i=1, #Winners do
table.remove(Winners, 1);
end;
end;
end;
2 comments
0
Thank you for your time. I'm still trying to learn how to script, so this helps me a lot. Thanks.
0
no problem.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
This isn’t even your code.
The reason why is because you haven't indented your code properly.
i made my script from scratch thanks to incapaz who helped me :3