Kill Detector
I am trying to detect when a zombie was killed using tags. When I spawn the zombie, it spawns with a silverfish along with it to act as a zombie detector.
Continue to help postexecute at @e[tag=zombie] run tag @e[tag=detectZombie,distance=0..1] add zombieThere execute at @e[tag=detectZombie] if entity @e[tag=!zombieThere,distance=0] run tellraw @a "ded" execute at @e[tag=detectZombie] run tp @e[tag=!zombieThere,type=silverfish,distance=0] ~ ~-2000 ~ tag @e[tag=zombieThere] remove zombieThere
Here is the code for detecting the kills.
summon zombie ~ ~1 ~ {Tags:["zombie"],Passengers:[{id:"silverfish",Tags:["detectZombie"],Invulnerable:true,NoAI:true,Silent:true,ActiveEffects:[{Id:14,Amplifier:1,Duration:20000000,ShowParticles:0b}]}]}
Here is my spawn function.
What am I doing wrong?