Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to not have all the player in the same team ?

Asked by 5 years ago
Edited 5 years ago

I want to know if there a way to equal

local Teams = game:GetService("Teams")
local T_Name = {
    [1] = "Blue Fighter",
    [2] = "Red Fighter"
}

for _,player in pairs(game.Players:GetPlayers()) do
    player.Team = Teams:FindFirstChild(T_Name[math.random(1, #T_Name)])
end

1 answer

Log in to vote
0
Answered by
KingDomas 153
5 years ago
Edited 5 years ago

Check for children (people in that team). If there are people there, check the other teams and see which one has the least amount of people in it. Then put the output into a variable and team them that variable. Theoretically this should work but since I'm bad at lua (rlua anyway) I don't know how to do that.

Ad

Answer this question