How to track when a player hits another player with a projectile

Look, im not a block coding pro but I’m positive that there is definitely a way to do this. It's not impossible