I've tried adding the players to a scoreboard whenever they join the world but it doesn't seem to work unless I rejoin the world
Current Code:
world.events.playerSpawn.subscribe(e => {
if (e.initialSpawn) return
e.player.runCommandAsync('scoreboard players add @s identity 1')
console.warn(`${e.player.scoreboard.id}`) // Throws an error as Player.scoreboard is undefined.
})```