local replicatedstorage = game:GetService('ReplicatedStorage')
local status = replicatedstorage:WaitForChild('InfoValue')
local mapstorage = game.Workspace:WaitForChild('mapStorage')
while true do
while game.Players.NumPlayers > 2 do
status.Value = "Not Enough Players! :( (2 or More)"
repeat wait(2) until game.Players.MaxPlayers >= 2
end
for i = 15,0,-1 do
game.Workspace.Music:Play()
status.Value = "Intermission:"..i
wait(1)
_G.gameplayers = {}
for i ,v in pairs(game.Players:GetPlayers() do
if v then
table.insert(_G.gameplayers, v.Name)
end
end
end
end
end
game.Workspace.Music:Stop()
local mapsinserverstorage = game:GetService('ServerStorage'):GetChildren()
local chosenmap = mapsinserverstorage[math.random(1,#mapsinserverstorage)]
chosenmap:Clone() .Parent = mapstorage
status.Value = "Teleporting Fighters"
wait(1)
local spawns = chosenmap:WaitForChild('Spawns'):GetChildren()
for _, player in pairs(game.Players:GetPlayers()) do
if player and #spawns > 0 then
local torso = player.Character:WaitForChild('Torso')
local allspawns = math.random(1,#spawns)
local randomspawn = spawns[allspawns]
if randomspawn and torso then table.remove(spawns,allspawns)
torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0,2,0))
local sword = game.ReplicatedStorage.BasicSword
local newsword = sword:Clone ()
newsword.Parent = player.Backpack
end
end
end
for i = 90,0,-1 do
status.Value = i..' Seconds Left'
if i == 0 then
status.Value = "Time Up!"
for _, players in pairs (game.Players:GetChildren()) do
if player:FindFirstChild('leaderstats') then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 2
end
end
break
else
end
for i = 60,0,-1 do
if i == 0 then
status.Value = "Time Up!"
break
end
wait (1)
if #_G.gameplayers== 1 then
for i,v in pairs (_G gameplayers) do
if v == nil then
status.Value = v.." is the Winner!"
break
end
end
break
end
end
mapstorage:ClearAllChildren()
wait(5)
end
Why won't this work?
1 answer
How to post good questions
- Explain what you've tried so far.
- Explain what you want your code to do.
- Do not only post code.
Style
Tab your code correctly. The column that text starts in should indicate the grouping of statements together (in an if, for, function, or table).
You have a syntax error:
44: ')' expected near 'do'
Looking at this line,
for i ,v in pairs(game.Players:GetPlayers() do
It is expecting the ) to close pairs(.
After fixing that, you have another syntax error.
24: '' expected near 'end'
This is when you must tab your code. It's not expecting an end where you have one.
The beginning, properly tabbed, looks like this:
local replicatedstorage = game:GetService('ReplicatedStorage')
local status = replicatedstorage:WaitForChild('InfoValue')
local mapstorage = game.Workspace:WaitForChild('mapStorage')
while true do
while game.Players.NumPlayers > 2 do
status.Value = "Not Enough Players! :( (2 or More)"
repeat
wait(2)
until game.Players.MaxPlayers >= 2
end
for i = 15,0,-1 do
game.Workspace.Music:Play()
status.Value = "Intermission:"..i
wait(1)
_G.gameplayers = {}
for i ,v in pairs(game.Players:GetPlayers()) do
if v then
table.insert(_G.gameplayers, v.Name)
end
end
end
end
end
Notice that final end is out of place -- the previous end was already at the far left.
I have no idea what you meant to do from here, because it doesn't make any sense to have any code after this while true do's end.
The rest of this code makes very little sense, too.
Problems
I'm just going to name a bunch.
Your
whileloop for "Not Enough Players" makes no sense. You have a while loop (that only pauses while there are enough players) that has a repeat loop pausing until there are enough inside.randomspawncan't benil. Use the fact thattable.removereturns what is removed, instead:local randomspawn = table.remove(spawns, math.random(#spawns))Don't use
if i == 0in aforloop. Just put your code after the loop ends.Don't use
_G. You don't need it for anything in here.
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
Add the error that outputs in the output window, or use print to find which line stops the script.
If FE is on you're going to have a ton of problems.
how exactly will he have problems for FE, i am sorta new to FE, but I thought you did not have to worry about normal scripts for FE., because i was believed to think that whatever can happen on server auto affects client
Eh, maybe not too many problems. The thing I see that jumps out is that you're accessing both ReplicatedStorage and ServerStorage. Scripts in FE can't access ReplicatedStorage, this is for the client.
Line 28 also has a random space :P