Detect snowball throw (and/or right click)
I'm trying to execute a function with a /playsound command inside whenever the player throws a snowball. I've tried using advancements, so that when the player throws the snowball they get an advancement that has that function as a reward, and then that function would also instantly revoke the advancement. This didn't work. When I granted the advancement with commands I did get the functon to execute, and revoke the advancement, but I couldn't get the advancement to trigger by throwing a snowball.
So does anyone know how I make this work? Or shouldn't I use advancements at all?