This script, was designed for Team Death Match, and it's not working. Here's everything you need to know about the script, before checking it out and helping me fix it;
It chooses teams
It chooses the team with the most players at the end as "Winner".
It's made to go in intermission at the end of each round.
It only starts when 2 or more players are in the game.
Selects random maps. Here's the script, you can try to fix it many people haven't been able to. If you could, I'd really appreciate it though, it's been such a stressing script, I've taken a long time, I'm not just into making games like this for the money, I'd like to have something fun to play here it is:
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(NumP/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.leaderstats.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 -- Someone said, that they felt something was wrong with this part of the script, maybe someone could fix it if there's a problem?
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(MLength)
m:Destroy()
end
end
while true do
if NumP >= 2 then
wait()
int()
wait()
mapchose()
wait()
assign()
wait()
round()
wait()
winner()
else
local m = Instance.new("Message", workspace)
m.Text = "This game requires 2+ players!"
wait(MLength)
m:Destroy()
end
end
