#XP
1 messages · Page 1 of 1 (latest)
huh?
What he means is that when the player collect XP, it's not get XP from player
no i ment when the players collects a xp orb
Detect how much total xp the player has, and compare it after it collected an XPs.
Well there is not event that handles this but you can run a check every tick to see if the xp has changed with abosberation limits it should be fine
system.runInterval(() => {
for (let player of world.getAllPlayers()) {
const xp = player.getTotalXp()
if ( player.lastXp < xp ) {
//Stuff
}
player.lastXp = xp
}
})
Or just use getTotalXp() so it covers overall player's xp including when leveling up.
@kindred orbit
Where do you get "mc.world.getAllPlayers()"?
Just use
"world.getAllPlayers()"
Didn't know that existed
cant u just get when the xp orbs despawn
get the nearest player to the orb
and thats the player that collected
Yea thats an option but sense you can't aborb more than one orb a sec it really dosen't make a diffrence