the best way i can think of is when you spawn a projectile start a process and repeat forever and select nearby players using the select block this way have a lot of downsides as the projectile might be faster than the checking so it might fail
in the process select either last entity or projectile (idk which one would work) and check the selection size, if it's 0 that means the entity died