#How to run command on Player's initial spawn?
1 messages · Page 1 of 1 (latest)
nothing was wrong with him destructuring
So his thing worked
So mines was right?!
world.afterEvents.playerSpawn.subscribe(({ initialSpawn, player }) => {
if (!initialSpawn) return;
player.runCommand('scoreboard players set @s lives 10')
})
there's scoreboard apis btw, you dont need to use commands.
Documentation for @minecraft/server
I prefer to use it with commands
This worked! Thanks man!!!
thats fine
just note that commands can be less performant than native methods.
in this case I doubt it'll be that much of a problem
I suggest you to check if the player has alredy the lives set, else you will get everytime he joins the world again 10 lives
Bruh, thanks because I tested it and it's resetting each time I join the world
it...????
sorry I clicked enter too early
no pronlem