#Why initialSpawn value is true everytime I spawn
1 messages · Page 1 of 1 (latest)
not for the first time
when the player join the game (that just filter out respawning from death)
you will have to tag hem or add a dp and use that as condition
playerSpawn event fires upon player spawning. This includes joining a world and respawning from death.
If initialSpawn is false, you can assume the player has just respawned from death.
Thanks for the help.
However, you can check if the player joined for the first time by marking them. Either using a tag, scoreboard, or something else.
Essentially, filtering out old players and new unregistered players.
I want to implement some custom msg for the players spawned for first time
so dynamic property is the right way
It gives the most security if you feel comfortable with it. Sure, go ahead
world.afterEvents.playerSpawn.subscribe((event)=>{
const {initialSpawn,player} = event;
const joined= player.getDynamicProperty("joined")
if(initialSpawn && !joined){
player.sendMessage("wlc")
} else if(initialSpawn){
player.setDynamicProperty("joined",true)
}
})
@weak yacht Thanks bro
I will bro.. thanks
just subbed you 🙏
tnx
i have no idea how is that channel still getting views
Wouldn't joined has to be !joined there? First time player would have joined to be undefined