Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Splitting Players Script?

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

1 comment

0

This is not a request site. Please make an attempt first, preferably with a script for proof, and then come back.

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.