0

So, I'm busy trying to make a series of commands that will allow me and my friends to have a custom survival experience. I need to have a command block that will add wings to a player's inventory if their score on a certain objective is 1, otherwise it won't add it. The command so far is as follows

execute as @a if score @s WingsExtended = 1 WingsExtended run replaceitem entity @e armor.chest minecraft:elytra{display:{Name:"{\"text\":\"Wings\"}",Lore:["You have wings now!"]},Unbreakable:1,Enchantments:[{id:"minecraft:binding_curse",lvl:1}],AttributeModifiers:[{AttributeName:"generic.maxHealth",Name:"Equalization factor",Amount:-18,Operation:0,UUIDMost:85873,UUIDLeast:124978}]}

Anyone got tips?

EDIT: I apologize, I thought that the issue was obvious. Nothing happens when I use the command. However, MegaCrafter10 seems to have solved the problem rather successfully, so I believe that the question was in fact clear enough to solve.

  • 1
    I assume the problem is that it doesn't work, but can you give more information? What happens when you use this command, for example? – Joachim Nov 21 at 17:34
  • 1
    Yes, please actually ask a proper question. And more details would be good, like what happens with that command, what variations you have tried to fix it, etc. – Fabian Röling Nov 21 at 19:53
0

The issue is in this part: if score @s WingsExtended = 1 WingsExtended the equal sign is used to compare two objectives and not to compare an objective to a value. Here is an example of how the equal sign is used: if score @s someObj = @p someObj.

To test for a specific value, use the keyword "matches", like this: if score @s WingsExtended matches 1 ...

so the correct command is:

execute as @a if score @s WingsExtended matches 1 run replaceitem entity @e armor.chest minecraft:elytra{display:{Name:"{\"text\":\"Wings\"}",Lore:["You have wings now!"]},Unbreakable:1,Enchantments:[{id:"minecraft:binding_curse",lvl:1}],AttributeModifiers:[{AttributeName:"generic.maxHealth",Name:"Equalization factor",Amount:-18,Operation:0,UUIDMost:85873,UUIDLeast:124978}]}

happy coding :)

  • Thank you very much. It now works as intended. – Piano VII Nov 22 at 11:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.