I make an item that gives attributes when eaten, but the sound doesn't play when eaten.
ItemEvents.foodEaten('kubejs:life_fruit', event => {
const {level} = event;
if(!event.player.stages.has('life_fruit_eated')) {
event.player.stages.add('life_fruit_eated')
event.player.inventory.clear(Item.of('kubejs:life_fruit'))
event.entity.modifyAttribute('minecraft:generic.max_health', 'health_extra_life_fruit', 5, "addition")
Utils.server.scheduleInTicks(1, () => {
event.player.heal(5)
level.playSound(null, p.x, p.y, p.z, 'minecraft:entity.player.levelup', 'master', 1, 1)
})
} else {
event.player.tell('§сВы уже использовали этот предмет!')
}
})