Minecraft Mob detector (Command Block)?

Pr
1

Does anyone know how I can detect a mob with a comand block when it is killed? E.g. When a chicken is killed does that get an effect?

Po

Create scoreboard objective: / scoreboard objectives add kill minecraft.custom: minecraft.mob_kills

Repeating command block: execute as @a [scores = {kill = 1}] run effect give @s minecraft: speed 3 5 true

Chain, Always Active Command block behind: scoreboard players reset @a kill