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

Broken map changer.Can anyone fix?

Asked by
painzx3 43
10 years ago

Additional info: I put a "stringvalue" with "2" as the value. Here's the script.

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.
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
m.Text = "Selecting map..."
wait(5)
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

1 answer

Log in to vote
0
Answered by
war8989 35
10 years ago

Line 6 is incorrect, change it to this:

Maps ={"Divide", "Karachi"}
Ad

Answer this question