Additional info: There's a stringvalue in the script named "map" and I put in "2" in it.
Red = game.Workspace.Bpos--change to where team1 spawns(red team) Note: use Vector3 cordinates Blue = game.Workspace.Rpos--change to where team2 spawns(blue team) lobby = game.Workspace.Lpos-- change the the position of the lobby(where the players go before/after the game) weapon = game.Lighting["Revolver"] weapon2 = game.Lighting["Knife"] Maps ={"Divide"},{"Karachi"}-- change Map1,Map2,Map3 to the name of your maps and put them in Lighting. you can add more just add: ,"another map" after Map3 and so on. local r = Maps[math.random(1,#Maps)] while true do wait(15)-- how long between games. script.map.Value = r local m = Instance.new("Message") m.Parent = game.Workspace for i = 3,1,-1 do wait(1) m.Text = "Selecting map in " ..i end m.Text = r.." has been chosen!" wait(4) g = game.Lighting[script.map.Value]:Clone() g.Parent = game.Workspace g:MakeJoints() m.Text = "Teleporting players..." wait(3) m:remove() d = weapon:Clone() c = weapon:Clone() d2 = weapon2:Clone() c2 = weapon2:Clone() local pplz = game.Players:GetChildren() for i = 1,#pplz do if pplz[i].TeamColor == BrickColor.new("Bright red") and pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then-- change to team1's TeamColor c.Parent = pplz[i].StarterGear d.Parent = pplz[i].Backpack c2.Parent = pplz[i].StarterGear d2.Parent = pplz[i].Backpack pplz[i].Character.Torso.CFrame = Red.CFrame + Vector3.new(0,i*15,0) d = weapon:Clone() c = weapon:Clone() d2 = weapon2:Clone() c2 = weapon2:Clone() elseif pplz[i].TeamColor == BrickColor.new("Bright blue") and pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then--change to team2's TeamColor pplz[i].Character.Torso.CFrame = Blue.CFrame + Vector3.new(0,i*15,0) d.Parent = pplz[i].Backpack c.Parent = pplz[i].StarterGear d2.Parent = pplz[i].Backpack c2.Parent = pplz[i].StarterGear end end wait(15)-- how long each game lasts. local pplz = game.Players:GetChildren() for i = 1,#pplz do if pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then --local clean1 = pplz[i].StarterGear:GetChildren() --clean1[i]:remove() --local clean2 = pplz[i].Backpack:GetChildren() --clean2[i]:remove() pplz[i].Character.Torso.CFrame = lobby.CFrame + Vector3.new(0,i*15,0) end end local m = Instance.new("Message") m.Parent = game.Workspace m.Text = "The round has ended!" wait(4) game.Workspace[script.map.Value]:remove() --m.Text = winner.." has won!" m:remove() end
One Your declaration of the variable Maps
is incorrect.
The correct version is as follows:
Maps = {"Divide", "Karachi"}
The syntax you used is suitable for setting several variables at the same time, for example:
apple, orange = 1, 2; print(apple); -- 1 print(orange); -- 2
For your original code, that means you did this:
Maps = {"Divide"}; _ = {"Karachi"}; -- never referenced again
which essentially means you've lost the remainder of your list.
Two You only generate your random variable once.
local r = Maps[math.random(1,#Maps)]
has to happen inside your while loop so that it happens each time.
I also see you have not improved the formatting, naming, or unnecessary complications of this script...
Shorter, simpler, cleaner
Red = game.Workspace.Bpos Blue = game.Workspace.Rpos lobby = game.Workspace.Lpos weapon1 = game.Lighting["Revolver"] weapon2 = game.Lighting["Knife"] Maps ={"Divide", "Karachi"} function giveTools(player) weapon1:Clone().Parent = player.StarterGear weapon1:Clone().Parent = player.Backpack weapon2:Clone().Parent = player.StarterGear weapon2:Clone().Parent = player.Backpack end while true do wait(15)-- how long between games. local mapName = Maps[math.random(1,#Maps)] local message = Instance.new("Message", game.Workspace); for i = 3,1,-1 do message.Text = "Selecting map in " .. i wait(1) end message.Text = mapName .. " has been chosen!" wait(4) local map = game.Lighting[mapName]:Clone() map.Parent = game.Workspace map:MakeJoints() message.Text = "Teleporting players..." wait(3) message:Destroy() local players = game.Players:GetChildren() for i = 1,#players do local p = players[i]; if p.Character and p.Character:FindFirstChild("Torso") then local spawn = false; if p.TeamColor == BrickColor.new("Bright red") then spawn = Red.CFrame + Vector3.new(0,i*15,0) elseif p.TeamColor == BrickColor.new("Bright blue") then spawn = Blue.CFrame + Vector3.new(0,i*15,0) end if spawn then p.Character.Torso.CFrame = spawn; giveTools(p); end end end wait(15) -- how long each game lasts. local players = game.Players:GetChildren() for i = 1,#players do local p = players[i]; if p.Character and p.Character:FindFirstChild("Torso") then p.Character.Torso.CFrame = lobby.CFrame + Vector3.new(0,i*15,0) end end local message = Instance.new("Message", game.Workspace) message.Text = "The round has ended!" wait(4) map:Destroy() --message.Text = winner.." has won!" message:Destroy() end