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

How can I evenly assign players on a team?

Asked by 5 years ago
Edited 5 years ago

I have a round based team game. I want the teams to be randomly assigned when the round starts. I know that teams have an auto assign feature, but I don't want players to be auto assigned when they join, but rather when the round starts. How would I do this? Here is a script I used:

for _, v in pairs(game.Players:GetChildren()) do
        Player = Instance.new("StringValue", workspace.Players)
        Player.Name = v.Name
        local f = math.random(1,2)
        if f == 1 then
        v.Team.BrickColor = BrickColor.new("Red")
        else 
        v.Team.BrickColor = BrickColor.new("Blue")
end
end

This script just randomly assigns players.

0
Show us what you have tried -- this is not a request site. SummerEquinox 643 — 5y
0
Do you want the teams to be even? User#5423 17 — 5y
0
Yes. CaptainD_veloper 290 — 5y

Answer this question