How do you put one player on a team and the rest on a different team at the start of a Rec Room game?

I want to have a game where one person gets randomly selected to go against all the other players in the room, kind of like the the TF2 juggernaut gamemode. At the end of the game, I want to pick a different person to be the "juggernaut" in the next round.


During the Pre game use a signal from the pre game output (blue) on the Game state chip, and it to the green input on a Combinator set to subtraction (this turns it into a -1), from the rec output on that Combinator send the signal to a team maper's red input. That team mapper needs to be set to "Set Player Team" the green input can be any team ID but lets use team 1 (blue). All that sends everyone to the same team.

Now to pick a random player from that team. There shouldn't be any gaps on the team index if you just moved everyone. Lets use the Player Event Chip to find the player count (blue output) and send that to a Combinator to ADD one to it. Now we need an RNG chip and set it to Pulse. Connect the red output from that Combinator to the blue input of the RNG chip, configure the green input to be one and the red input is either a delay from the pregame or on game start from the gamestate chip. Now this well give us a number we can use for a team index.

Use a Team Mapper chip and configure it to be Team To Player. Configure the green input to be the team you moved everyone to (so team one) and the blue input from the RNG chip's output. This gives us a Player ID, we can now send that to an other Team Mapper set to "Set Player Team". Send the Player ID from the Team to Player chip to the Set Team chip's red input and pick a team for the green input, Two is red team.


The best way to do this is have all players start on Team 1 (can be done by putting a -1 and a 1 into a team mapper chip configured to set players team, with the -1 going into the red pin, and a 1 into the green. This will put everyone onto team 1, and only needs to be run before the start of the game.

The game chip needs to be configured so that it fills the largest team, so any player joining is automatically on team 1

To actually select the random player, you need to have a player event chip, giving the total number of players into the blue pin of an rng. Have a 0 on the green pin and send a signal to the red pin when you want to select your player. On the red output chip, wire it to a combinator set to + and configure a 1 on any other input pin. This will correct the rngs range from 0 to x-1 to 1 to x. Wire the output of the combinator to a delay chip and wire that to the index pin of a team mapper, with the team set to one. This will choose a player within team 1 for us.

Once you have done that, wire the output of the team mapper to another team mapper chip, with the output going into the player input, and the team tab configured to 2, this will set a random player to team 2.

Any questions or issues with the circuit, feel free to let me know