I'm trying to change the mob's weapon if the player is near but it wont change

I'm trying to change the mob's weapon if the player is near but it wont change - Crop black man in casual clothes opening retro recorder to change cassette during resting on concrete surface with skateboard in city street

Everything seems fine as far as the command goes but the weapon of the enemy won't change.

execute at @e[type=minecraft:skeleton,name="Soldier"] if entity @a[distance=..5] run replaceitem entity @s weapon.mainhand minecraft:iron_sword 1





Pictures about "I'm trying to change the mob's weapon if the player is near but it wont change"

I'm trying to change the mob's weapon if the player is near but it wont change - Man in Black Leather Jacket Holding Man in Black Leather Jacket
I'm trying to change the mob's weapon if the player is near but it wont change - Free stock photo of administration, adult, africa
I'm trying to change the mob's weapon if the player is near but it wont change - Bitcoins and U.s Dollar Bills





Tones And I - Dance Monkey (Lyrics)




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Budgeron Bach, RODNAE Productions, RODNAE Productions, David McBee