Well the death/kill counter is kinda broken, its counting kills/deaths, but only deaths from being killed from other players, idk why its not working with other ways of deaths? (and its not also giving me any sort of error)
Code:
world.afterEvents.entityHurt.subscribe((data) => {
let { hurtEntity: entity } = data
let player = data.damageSource.damagingEntity
if (player?.typeId !== 'minecraft:player') return;
if (entity.typeID != "minecraft:player") return;
/**
* @type {EntityHealthComponent}
*/
// @ts-ignore
const health = entity.getComponent("health");
if (health.currentValue > 0) return;
entity.runCommandAsync("function other/death");
if (player.typeId != "minecraft:player") return;
player.runCommandAsync("function other/kill");
});