I want to replace an equipped leather cap with a glass block. I tried /replaceitem entity @s slot.armor.head glass, but it didn’t work.


Solution 1:

This is the syntax for /replaceitem:

/replaceitem <block|entity> <position or target> <slot type> <slot ID> <item name> [amount] [data] [components]

You forgot to define the slot ID, which in your case should be 0:

/replaceitem entity @s slot.armor.head 0 glass

You can find more information about /replaceitem on this site.