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

Splitting Players Script?

Asked by 8 years ago

I am making a cops and robbers game it needs a minimum of 4 players to start. I need a script where it split everyone randomly. I've tried my all to find a way to do it and nothing seems to work. I really need help with this. Thanks

0
This is not a request site. Please make an attempt first, preferably with a script for proof, and then come back. User#6546 35 — 8y

1 answer

Log in to vote
0
Answered by
Unlimitus 120
8 years ago

I suggest that you use this template script:

for index, player in pairs(game.Players:GetChildren()) do
    if index % 2 == 0 then
        --Assign to the Cops Team
    else
        --Assign to the Robbers Team
    end
end

Its a simple script, that might always give off the same result (Players always being on one team instead of the other) but that will change if players are leaving the game and joining the game.

Ad

Answer this question