#player not defined??
1 messages · Page 1 of 1 (latest)
try
world.afterEvents.entityHitEntity.subscribe((event) => {
const player = event.damagingEntity;
const hit = event.hitEntity;
if (!hit) return;
//gif 1
if (hit.typeId == 'entity:ex') {
player.runCommand("give @s diamond")
}
});
wait isn't the type id of the normal villager minecraft:villager_v2
yeah this work
world.afterEvents.entityHitEntity.subscribe(data => {
if (!(data.damagingEntity instanceof Player)) return;
if (data.hitEntity.typeId !== "minecraft:villager_v2") return;
world.sendMessage('test')
}
)