Detect player being hit by snowball

Hello,

Im just trying to make knockback snowball.

As I know, teleport is actually bad idea due to it can glitch into wall. So instead, Im doing /damage.

But problem is, Im actually not sure how to detect snowball that also detect player being hit then runs command to damage to the player, not to snowball.

execute as @e[type=snowball] at @s run execute as @e[type=!snowball, distance=..1, limit=1] at @s run function fun:snowball

  • fun/snowball execute as @s run damage @s 0.01 minecraft:wind_charge

This does not work at all

Continue to help post