The script is long, sorry if you have to read all of it. I just can't find what's wrong with the script, please help.
Maps = {"Wobbly Bridge", "Tower of Magic"}
randomMap = Maps[math.random(#Maps)]
Players = game.Players:GetPlayers()
NumP = game.Players.NumPlayers()
L = game.Lighting:GetChildren()
TimeOfRound = 160
MLength = 1
IntermissionTime = 30
MessageTBS = "Seconds Left: "
function mapchose()
local m = Instance.new("Message", workspace)
m.Text = "You will be playing on the "..randomMap.." map."
wait(MLength)
m:Destroy()
L:findFirstChild(randomMap):Clone().Parent = workspace
end
function int()
local m = Instance.new("Message", Workspace)
a = IntermissionTime
for i = 1,IntermissionTime do
wait(1)
m.Text = "Intermission, "..MessageTBS..tostring(a)-1
end
m:Destroy()
end
BrightBlue={}
BrightRed={}
function assign()
local Quarter = math.floor(Game.Players.NumPlayers/2)
local Players = Game.Players:GetPlayers()
for i = 1, #Players do
local random = table.remove(Players, math.random(#Players))
if i <= Quarter then
random.TeamColor = BrickColor.new("Bright red")
table.insert(BrightRed,random)
else
random.TeamColor = BrickColor.new("Bright blue")
table.insert(BrightBlue,random)
end
end
end
function round()
for i = 1,TimeOfRound do
wait(1)
for i,v in pairs(Players) do
if v.WipeOuts.Value >10 then
for i, z in ipairs(BrightBlue) do
if (not z) or v == z then
table.remove(BrightBlue,i)
end
end
for i, z in ipairs(BrightRed) do
if (not z) or v == z then
table.remove(BrightRed,i)
end
end
end
end
end
end
function winner()
if #BrightBlue == #BrightRed then
local m = Instance.new("Message", workspace)
m.Text = "The teams have tied!"
wait(MLength)
m:Destroy()
elseif #BrightBlue > #BrightRed then
local m = Instance.new("Message", workspace)
m.Text = "The Blue Team has won!"
wait(MLength)
m:Destroy()
elseif #BrightRed > #BrightBlue then
local m = Instance.new("Message", workspace)
m.Text = "The Red Team has won!"
wait(MLenght)
m:Destroy()
end
end
while true do
if NumP >= 2 then
int()
mapchose()
assign()
round()
winner()
else
local m = Instance.new("Message", workspace)
m.Text = "This game requires 2+ players!"
wait(MLength)
m:Destroy()
end
end

1 comment
I don't know any other ways to fix that @ShawnyG