title: Add automatically a team?
body: <p>I'm programming a game in which I have to set a team based on the <strong>position</strong> of the player when the game starts. Can you help me?</p>
  <pre><code>var playerz = [];
  
  room.onPlayerJoin = function () {
    playerz.push({
      name: player.name,
      id: player.id,
      team: 0,
      position: { x: null, y: null },
    });
  
  room.onGameStart = function () {
    TeamRed = playerz.filter(
      (p) =&gt; p.position[&quot;x&quot;] === 103 &amp;&amp; p.position[&quot;y&quot;] === -178.5
    );
    TeamYellow = playerz.filter(
      (p) =&gt; p.position[&quot;x&quot;] === -206 &amp;&amp; p.position[&quot;y&quot;] === 0
    );
    TeamBlue = playerz.filter(
      (p) =&gt; p.position[&quot;x&quot;] === 103 &amp;&amp; p.position[&quot;y&quot;] === 178.5
    );
  };
  </code></pre>
  <p>What I've done is to rename the player based on the position, but I actually need to rename the <strong>team</strong> based on these positions. Of course, I could do it manually verifying the position of each player but in some maps players are more than 10 so I need to do it <strong>automatically</strong>. Can someone help me?</p>
  <p>P.S. Never mind about player, it's a built-in-game parameter.</p>