Minecraft – My command-block augmented sword isn’t freezing players when they’re hit!

minecraft-commandsminecraft-java-edition

I've made a sword that gives slowness 10 for 2 seconds to any player that is hit by it. It used to worked, but now seems to not work for some reason. This is how it works:

There are two scoreboards, dmgTFS which is damage taken and dmgDFS which is damage dealt.

The command blocks are laid out like this:

[R] > [C] > [C] > [C] > [C] > [comparator] > [impulse] > [C] > [C] > [C] (R= repeating, C= chain, impulse= impulse)

Commands (from left to right):

/scoreboard players tag @a add holdingFS {SelectedItem:{id:"minecraft:iron_sword",tag:{display:{Name:"Frost Sword"}}}}

/scoreboard players tag @a[score_dmgDFS_min=1,tag=holdingFS] add hit

/execute @a[tag=hit] ~ ~ ~ /execute @a[r=5,tag=!hit] ~ ~ ~ /scoreboard players tag @p[score_dmgTFS_min=1,r=0,c=1] add possHit

/execute @a[tag=hit] ~ ~ ~ /scoreboard players operation @a[tag=possHit,r=5] dmgTFS -= @p[tag=hit,r=0,c=1] dmgDFS

/execute @a[tag=possHit,score_dmgTFS_min=0] ~ ~ ~ /scoreboard players tag @p[r=0,c=1] add confirmedHit

(comparator goes here)

/execute @a[tag=confirmedHit] ~ ~ ~ /effect @p[r=0,c=1] slowness 2 10

/scoreboard players tag @a[tag=confirmedHit] remove possHit

/execute @a[tag=confirmedHit] ~ ~ ~ /scoreboard players tag @a[tag=hit,r=5] remove hit

/scoreboard players tag @a[tag=confirmedHit] remove confirmedHit

There are also three separate repeating command blocks that constantly set the score of dmgDFS and dmgTFS to 0 and that constantly remove the holdingFS tag. Once again, it worked at first, but somehow doesn't seem to work now.

Here's the world if you need to experiment with the commands (the area with the commands is outlined with red wool): https://www.mediafire.com/?erif2zo7q25fkq7

What seems to be preventing it from working?

Best Answer

It works now. I just removed the comparator (I don't know what I was thinking, the comparator is like a worse chain command block) and put the scoreboard resets at the end of the line and it works just fine now.