#addEnchantment not working.

1 messages · Page 1 of 1 (latest)

dapper marten
#

Here is the code:

const soulSpeed = new Enchantment("soul_speed", 2)

const item = player.getComponent('equipment_inventory').getEquipmentSlot("feet").getItem();
if (!item) return;

const item_enchants = item.getComponent("enchantments").enchantments;
if (!item_enchants) return;

item_enchants.addEnchantment(soulSpeed);

I get no errors, it just doesn't work.

foggy flame
#

I don't really know much about scripting but is const soulSpeed = new supposed to be that way?

#

I think that you have to set the item again.

dapper marten
#

thanks though, that seemed to work

dapper marten
foggy flame
#

discord was showing the code for me in the wrong way, oof