So I wanted players to reciver souls when they kill someone. I implemented this to give them the soul (uses essentials to make the item) and it works but when they jumped into the void or were hit the players wouldn't receive a soul. So I used the loop someone else made but now if someone jumps or falls into the void without being hit again they will still die to the damager and the damager will still get the soul. Is there anyway to reset who the damager and victim are to not do this?
Code:
on death:
if damage cause is not void:
victim is a player
damager is a player
execute console command "give %damager% ghast_tear 1 name:&4Soul lore:&cA_human_soul"
send "&aYou killed &4%victim%" to damager
send "&e&l<&c&l!&e&l>&b You have gained a Soul" to damager
send "&aYou were killed by &4%damager%" to victim
every 1 second:
loop all players:
if loop-player's y coordinate is below 1:
set loop-player's health to -1