Sound Playing when hitting a target

When making a game:
When the sprite hits the target it plays sound. How do you make the sound stop after it hits the target?

Hi @nmackow,

Although I am not sure of your specific example, there could be a few reasons. The simplest answer from the documentation is to make sure the loop parameter is set to false.

Another reason the sound continues to play is because whatever was true to trigger the sound, loops 32 times per second so it is likely the sound will start to play again and again. So, to problem solve this, the best way is to make sure what triggers the sound to play quickly becomes false so the sound doesn’t continually trigger to play over and over. Here is a recommendation from @elizabeth_admin from another post:
“For example, have a won variable that is originally set to false. Then, inside the winnerWinner function, instead of just checking to see whether (score >= 10) , check for ((score >= 10) && (won ==false)) . Then set won to true inside that code.”
I also have a super simple example HERE. The sound plays only once because the variable is ==10 for only 1/32 of a second.

I hope these tips help. If not, can you share a link to your project so we can get a better idea of the issue.

Michelle

set the loop value as false.