#Is this a error, if it is, how to fix it ?
1 messages · Page 1 of 1 (latest)
[Scripting][error]-TypeError: cannot read property 'typeId' of undefined at <anonymous> (enchant_shop.js:37)
That because your if still run. Use ? before typeId
world.events.entityHit.subscribe(({entity, hitEntity}) => {
if (hitEntity?.typeId == "npc:blacksmith") {
es(entity)
}
});