# Sound Playing when hitting a target

**URL:** <https://forum.code.org/t/sound-playing-when-hitting-a-target/32623>\
**Category:** CS Discoveries\
**Created:** [May 1, 2020, 4:21pm UTC](https://forum.code.org/t/sound-playing-when-hitting-a-target/32623 "2020-05-01T16:21:53Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![melynn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/melynn/32/4925_2.png) [@melynn](https://forum.code.org/u/melynn)\
**Post date:** [May 1, 2020, 5:57pm UTC](https://forum.code.org/t/sound-playing-when-hitting-a-target/32623/2 "2020-05-01T17:57:55Z")

</div>

Hi @nmackow,

Although I am not sure of your specific example, there could be a few reasons. The simplest answer from the [documentation](https://studio.code.org/docs/gamelab/playSound/) 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](https://studio.code.org/projects/gamelab/E2U_mUQef-Lz_MkM2KvQXPSfWTZ7xadJDB6ztKetuis). 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

---

_[View the full topic](https://forum.code.org/t/sound-playing-when-hitting-a-target/32623)._
