Team Balancing Help

  1. I want to achieve a system of balancing quite a bit of teams (currently around 5 but I plan on adding more), This system will also have a rarity for each team so lets say: there’s a team called hunters (being the rarest) and then a sheriff team, and so on. I tried using for loops and such. But all I currently have is a round system and I only need help to make the team balancing/rarity system.

  2. My issue is I don’t know how to execute this. I’ve tried some ways but none of them have worked.

  3. I have tried looking on the developer forum, youtube, even other sites however nothing worked

1 Like

pov: no script provided

1 Like

It’s really just two for loops that countdown intermission and round time with bool values that change. literally just the most simple round script you can make

we still need it, otherwise i can’t easily figure it out
i cannot reconstruct the script myself

game.Players.PlayerAdded:Connect(function(player)
player.Team = teams.LOBBY
end)

playingRound.Changed:Connect(function()
wait(1)
if playingRound.Value == true then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = MTF.CFrame
end
else
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = LOBBY.CFrame
end

end

end)

local function round()
while wait() do
for i = int, 1, -1 do
playingRound.Value = false
wait(1)
status.Value = “Intermission (”…i…")"
end
for i = rt, 1, -1 do
playingRound.Value = true
wait(1)
status.Value = i
end
end
end

im redoing it because i cant read this abomination of a script

game.Players.PlayerAdded:Connect(function(player)
 player.Team = teams.LOBBY
end)

playingRound.Changed:Connect(function()
wait(1)
if playingRound.Value == true then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = MTF.CFrame
end
else
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = LOBBY.CFrame
end

end
end)

local function round()
while wait() do
for i = int, 1, -1 do
playingRound.Value = false
wait(1)
status.Value = “Intermission (”…i…")"
end
for i = rt, 1, -1 do
playingRound.Value = true
wait(1)
status.Value = i
end
end
end

if you want to achieve quite a bit of balancing, i suggest you do some patterning (math moment)
ive never did team balancing so if it doesnt work blame my stupid brain

local count = 1
local function teams()
 for c = 1, game.#Players do
  game.Players[1].Team = game.Teams[count]
  count += 1
  if count == 6 then
   count = 1
  end
 end
end
1 Like

I mostly asked about the team balancing and team rarity I’ll try the team balance script you made but do you have any idea on how to the rarity?

local count = 1
local tableofteams = {"uncommon", "rare", "common", "uncommon", "common", "common"}
local function teamsrarity()
 for c = 1, game.#Players do
  game.Players[1].Team = game.Teams[tableofteams[count]]
  count += 1
  if count == 7 then
   count = 1
  end
 end
end

whatever so simple i hope you dont want team bal and rarity at the same time

Thanks, I’ll try this when I can

Hey, so how do you determine what team is the rarest. I don’t fully understand that script

i just copy and pasted team names, i copy and pasted common 3 times, uncommon 2 times, and rare 1 time
not very effective tho because it’s not my skill

So you’re looking to achieve weighted team balancing?

local Game = game
local Players = Game:GetService("Players")
local Teams = Game:GetService("Teams")

local RandomObject = Random.new()

local RedTeam = Teams.RedTeam
local BlueTeam = Teams.BlueTeam
local YellowTeam = Teams.YellowTeam
local GreenTeam = Teams.GreenTeam

local TeamWeights = {
	{RedTeam, 0.4},
	{BlueTeam, 0.25},
	{YellowTeam, 0.25},
	{GreenTeam, 0.1}
}

local function RebalanceTeamsWeighted()
	for _, Player in ipairs(Players:GetPlayers()) do
		Player.Team = nil --Reset every player's team.
	end
	
	for _, Player in ipairs(Players:GetPlayers()) do
		local Number = Random:NextNumber(0, 1) --Generate random number.
		local Value = 0
		for Index, TeamWeight in ipairs(TeamWeights) do --Iterate over team's weights table.
			Value += TeamWeight[2] --Increment value by team's weight.
			if Number > Value then continue end --Check if generated number falls below the cumulative value.
			Player.Team = TeamWeight[1] --Assign player to the team.
			break --Break the loop and continue with the next player.
		end
	end
end

Just an example.

2 Likes

Hey, I put this script in my round system and renamed the teams to the appropriate names however it doesn’t seem to do anything, There’s no errors either.

Did you remember to call the function?

I think this will help you: https://developer.roblox.com/en-us/articles/team-balancing