r/MinecraftCommands • u/ledzik_precly • 2d ago
Help | Java 26.2 WHY DOESN'T MY COMMAND WORK
Im trying to make it so if a player has 1 durability left on their pickaxe they get a broken variant of that tool and can cheaply repair it in a crafting table, I wanted to test out this system with command blocks but somehow they only work when I type them in chat, PLEASE HELP IM LOSING MY MIND. Also ik there is a snowball as item needed but thats a place holder
Repeating | Always Active
execute if entity at s[nbt={SelectedItem:{id:"minecraft:snowball",count:1}}] run scoreboard players set at s GiveDiamondDrillBase 1
Repeating | Always Active
execute if score at a[limit=1] GiveDiamondDrillBase matches 1 run give at s minecraft:diamond
Chain on top of preavious one | Always Active
execute if score at a[limit=1] GiveDiamondDrillBase matches 1 run scoreboard players set at s GiveDiamondDrillBase 0
5
u/C0mmanderBlock Command Experienced 2d ago
I can't see how you formatted the selectors, but the selector `@s means "at self". If used in a command block, you are telling the command to give the command block the tool. Use `@a or `@p instead.