--CAN CHANGE-- --Remember: Caps and spelling matter if you edit anything below! local Admins = { ["flipflop8421"] = true; ["GalaxyMaster99"] = true; ["Player1"] = true; } local Clan = 199219 local MinimumRank = 16 -- V - DO NOT CHANGE UNLESS SURE YOU WON'T BREAK - V -- local IsAdmin = function(Plr) if Admins[Plr.Name] then return true end if Plr:GetRankInGroup(Clan) >= MinimumRank then return true end return false end function randomiseTeams() redt = Instance.new("Team",game.Teams) redt.Name = "Red team" --Name for the red team redt.AutoAssignable = false redt.TeamColor = BrickColor.new("Bright red") bluet = Instance.new("Team",game.Teams) bluet.Name = "Blue team" --Name for The blue team bluet.AutoAssignable = false bluet.TeamColor = BrickColor.new("Bright blue") colors = {"Bright red","Bright blue"} count = { ["Bright blue"] = 0; ["Bright red"] = 0; } for _,v in pairs(game.Players:GetPlayers()) do if v.TeamColor ~= BrickColor.new("Bright violet") then --Change to match trainer team color. random = math.random(1,2) v.TeamColor = BrickColor.new(colors[random]) count[colors[random]] = count[colors[random]] +1 end end repeat wait() if count["Bright red"] > count["Bright blue"] then p = game.Players:GetPlayers() for i = 1,#p do if p[i].TeamColor == BrickColor.new("Bright red") then p[i].TeamColor = BrickColor.new("Bright blue") count["Bright red"] = count["Bright red"] -1 count["Bright blue"] = count["Bright blue"] +1 break end end elseif count["Bright blue"] > count["Bright red"] then p = game.Players:GetPlayers() for i = 1,#p do if p[i].TeamColor == BrickColor.new("Bright blue") then p[i].TeamColor = BrickColor.new("Bright red") count["Bright blue"] = count["Bright blue"] -1 count["Bright red"] = count["Bright red"] +1 break end end end until count["Bright red"] - count["Bright blue"] <= 1 and count["Bright blue"] - count["Bright red"] <= 1 end function resetTeams() for _,v in pairs(game.Players:GetPlayers()) do if v.TeamColor ~= BrickColor.new("Bright violet") then ----Change to match trainer team color. v.TeamColor = BrickColor.new("Bright orange") ----Change to match trainee team color. end end for _,v in pairs(game.Teams:GetChildren()) do if v.TeamColor == BrickColor.new("Bright red") then v:Destroy() elseif v.TeamColor == BrickColor.new("Bright blue") then v:Destroy() end end end game:GetService("Players").PlayerAdded:connect(function(Plr) wait(0) if IsAdmin(Plr) then Plr.Chatted:connect(function(Msg) Msg = Msg:lower() if Msg == ":randomize" then randomiseTeams() elseif Msg == ":reset" then resetTeams() end end) end end)