#Why doesn't work

1 messages · Page 1 of 1 (latest)

plain sky
#
const sourceEquip = source.getComponent("minecraft:equippable");
  const targetEquip = target.getComponent("minecraft:equippable");
  if (sourceEquip && targetEquip) {
    const slots = [
      "EquipmentSlot.Mainhand",
      "EquipmentSlot.Offhand",
      "EquipmentSlot.Head",
      "EquipmentSlot.Chest",
      "EquipmentSlot.Legs",
      "EquipmentSlot.Feet",
      "EquipmentSlot.Body"
    ];

    for (const slot of slots) {
      const item = sourceEquip.getEquipment(slot);
      if (item) {
        targetEquip.setEquipment(slot, item);
      }
    }
  }
onyx sail
#

the slots should be:
["Mainhand", "Offhand", "Head", "Chest", "Legs", "Feet"]

"body" is for saddle or wolf armor slot iirc

spark jolt
#

you can do EquipmentSlot.whatever if you imported EquipmentSlot, however you have the elements in the array as strings, dont make them strings.
also, EquipmentSlot.Body does not exist.