#Player join detection

1 messages · Page 1 of 1 (latest)

noble tapir
#

how to execute a command at a player when he join the world

zinc citrus
#
world.afterEvents.playerSpawn.subscribe(({player, initialSpawn}) => {
    if (!initialSpawn) return
    // stuff
}) 
noble tapir
#

what is stuff ?

#

and why InitialSpawn ?

zinc citrus
#

your code

noble tapir
#
world.afterEvents.playerSpawn.subscribe(({ player, InitialSpawn }) => {
    if (!InitialSpawn) return
    player.runCommandAsync('tp -2000 203 -2000')
})``` like that ?
zinc citrus
#

yes

zinc citrus
urban marlin
#

Otherwise it runs each time the player respawns (after death)

hot yacht
#

player.teleport exists