I have this script which works find except for one thing that I don't know how to fix. At one part of the script, it generates a number, either 1 or 2, and that number is the one that decides which map is loaded, the only problem is that with multiple people the value seems to have multiple numbers somehow and it calls for more than one map. How can I fix this? I'm using intvalue as the value for the map number, if that's what's causing the problem.
gm = game.Workspace.GMstat.Intermission
while true do
ToMapOne = CFrame.new(-2, 20.5, -50)
ToMapTwo = CFrame.new(-27, 69.5, 18)
ToSpawn = CFrame.new(277.5, 1.5, -206.5)
mapc = game.Workspace.MapNum.Value
wait(29)
gm.Name = "Game In Progress"
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("Torso") then
mapc.Value = (math.random(2))
wait(1)
if mapc.Value == 1 then
print(mapc.Value)
player.Character.Torso.CFrame = ToMapOne + Vector3.new(0, i * 5, 0)
player.TeamColor = game.Teams["Playing"].TeamColor
for i, m1 in ipairs(game.Workspace.MapOne:GetChildren()) do
m1.Transparency = 0
m1.CanCollide = true
end
end
if mapc.Value == 2 then
print(mapc.Value)
player.Character.Torso.CFrame = ToMapTwo + Vector3.new(0, i * 5, 0)
player.TeamColor = game.Teams["Playing"].TeamColor
for i, m2 in ipairs(game.Workspace.MapTwo:GetChildren()) do
m2.Transparency = 0
m2.CanCollide = true
end
end
end
end
wait(60)
gm.Name = "Intermission"
for i, m1 in ipairs(game.Workspace.MapOne:GetChildren()) do
m1.Transparency = 1
m1.CanCollide = false
end
for i, m2 in ipairs(game.Workspace.MapTwo:GetChildren()) do
m2.Transparency = 1
m2.CanCollide = false
end
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("Torso") then
player.TeamColor = game.Teams["Lobby"].TeamColor
player.Character.Torso.CFrame = ToSpawn + Vector3.new(0, i * 5, 0)
end
end
end

2 comments
Still doesn't work. Some error at line 52
I had a typo. Just read the code, it shouldn't be hard to figure out. Not to mention only the final, total rewrite had the mistake. Read the answer, while you're at it.