Adding players to a team when joining not working

Nolix
Joined 08/01/2021
Posts 25
10:24 PM 12/04/2021
for some reason this code isn't working for me, theres no errors or anything it just doesnt work

const playersTeam = new Team(Players, #0000CD)

Game.on(playerJoin, player => {
player.team = playersTeam
})

can anyone help me please?


[Code] Noah Cool Boy
Joined 20/06/2019
Posts 1,129
11:20 PM 12/04/2021
Instead of assigning the team directly, use the player.setTeam function
https://brickhill.gitlab.io/open-source/node-hill/classes/player.html#setteam

Using the function, node-hill will take care of sending the appropriate packets


[Pie] Piero
Joined 19/02/2020
Posts 1,296
01:26 PM 13/04/2021
It's also good to make sure that assigning teams at random is set to false, so put Game.assignRandomTeam = false at the top of the script.

1