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

How do you make a player switch teams? [SOLVED]

I'm making a game and I'm trying to split the players up into teams.

Only thing is, I don't know what you would do to have them switch teams in the script.

Help, please.

1 answer

✓ Accepted answer

Players are identified into their teams by the TeamColor property in the Player object. This value is a BrickColor value.

To switch a player to a Team, change the Player's TeamColor property to the same color as a Team.

Here's an example:

game.Players.Kenetec.TeamColor = game.Teams.SomeTeamName.TeamColor

To further help with your question, to split all players into two teams, you should assign a variable to a table of Players, randomize it if needed, and then split the table into two tables down the middle. Then iterate through each table and put the Players into their respective teams.

1 comment

0

The last paragraph is gibberish to someone who doesn't know how to change a player's team. Elaborate. Can you be more specific?

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