Effect others with armor [closed]
I'm attempting to make an adventure map but I got a little stuck with the commands.
I'm trying to make it when I put on a named leather helmet other players in the game will get the potion effect glowing. Anyone who knows a little commands probably know how to do this but I'm a noob so please help me.
I attempted to use scoreboards making it when player is where a helmet set a dummy scoreboard to 1 and then test for players with the score one and if it gets that going into a chain command block then to effect player with the score of 0 but that didn't work any ideas of how I can fix it.
Here is a solution that adds a scoreboard tag to any player wearing a leather helmet named Test. This tag is then used to target only the other players and apply the effect. Commands are for 1.12.2.
Use 2 command blocks in a chain.
The first command block is RepeatUnconditionalAlways Active with command:
scoreboard players tag @a remove Wearing
The second command block is ChainUnconditionalAlways Active with command:
scoreboard players tag @a add Wearing {Inventory:[{Slot:103b,id:"minecraft:leather_helmet",tag:{display:{Name:Test}}}]}
Now you can use that tag to target the players who are not currently wearing the leather helmet by adding it to the target selector. By using the execute command, the command will only run if at least one person is wearing the leather helmet. As soon as a single player puts on the helmet, all other players will have the glowing effect.
One more command block. It is another RepeatUnconditionalAlways Active with command:
execute @a[tag=Wearing] ~ ~ ~ effect @a[tag=!Wearing] minecraft:glowing 1 255 true