Hi, a friend of mine made a script that randomly chooses a map for the server. It worked for a while but then broke around a week or two ago. It still works in solo mode but only loads the same map in play mode. Any suggestions/help?
maps = game.Lighting.Maps
current = Workspace.Current
stage = script.Stage
_G["Randomize"] = function()
local m = maps:GetChildren()
local n = m[math.random(1, #m)]
local map = n
map.Name = "CurrentMap"
map.Parent = current
current.MapType.Value = map.Type.Value
for i,v in pairs(map:getChildren()) do
if v.Name == "Barb Spawn" then
v.TeamColor = BrickColor.new("Brown")
elseif v.Name == "XL Spawn" then
v.TeamColor = BrickColor.new("Bright red")
elseif v.Name == "Aux Spawn" then
v.TeamColor = BrickColor.new("Bright blue")
end
end
end
_G["Remove"] = function()
for _,v in pairs(game.Players:GetChildren()) do
v.Character = nil
end
end
_G["Respawn"] = function()
for _,v in pairs(game.Players:GetChildren()) do
v:LoadCharacter()
end
end
_G.Randomize() |