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

How do you split teams evenly?

Asked by
Scythax 35
9 years ago

I've been working on this script;

        local T1 = instance.new("Team",Teams)
    T1.TeamColor = "Bright blue"
    wait(0.1)
    local T2 = instance.new("Team",Teams)
    T2.TeamColor = "Bright red"
    -- Work in progress...

There's more to it, but that's as far as I got. To when it creates teams. Alright, now what I'm asking might not be "Simple", but it's just a question on how to split players up into 2 teams blue, and red from the spectating team?

0
I'm not sure if I understand you correctly but you could also make the spectating team not auto- assignable wjs3456 90 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
function Even()
    GetMembers = game.Players:GetChildren()
    Number = 0
    for i=1, #GetMembers do
        Number = Number + 1
        if Number > #Teams then Number = 1 end
        GetMembers[i].TeamColor = Teams[Number].TeamColor
    end
end
game.Players.ChildAdded:connect(Even)
game.Players.ChildRemoved:connect(Even)
Ad

Answer this question