# Lesson 14 - Sound add

**URL:** <https://forum.code.org/t/lesson-14-sound-add/32206>\
**Category:** CS Discoveries\
**Tags:** csd-unit-3-lesson-14\
**Created:** [February 5, 2020, 9:52pm UTC](https://forum.code.org/t/lesson-14-sound-add/32206 "2020-02-05T21:52:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![burnsk](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@burnsk](https://forum.code.org/u/burnsk)\
**Post date:** [February 5, 2020, 9:52pm UTC](https://forum.code.org/t/lesson-14-sound-add/32206/1 "2020-02-05T21:52:15Z")

</div>

> **[Check out what I made](https://studio.code.org/projects/gamelab/cVbmNPM5UigGPH4qL4q3ozPcykTFrMSMczL9M5l1mio)**
>
> I wrote the code myself with Code.org

Student would like to make it play the coin sound when guano scale changes from 4 to 0 and only when it changes. Not when it is equal to 0. Can someone help?

Thank you

---

<div class="post-metadata">

**Author:** ![infinitestasis](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/infinitestasis/32/5047_2.png) [@infinitestasis](https://forum.code.org/u/infinitestasis)\
**Post date:** [February 5, 2020, 10:34pm UTC](https://forum.code.org/t/lesson-14-sound-add/32206/2 "2020-02-05T22:34:59Z")

</div>

Use a variable to store the previous scale, at the end of each loop check whether the previous scale was 4 and the current scale is 0.  
[https://studio.code.org/projects/gamelab/t18Av5-Ctjfh\_wB8t-KpGiua4Zh9eB8-7A-3tXhliaU](https://studio.code.org/projects/gamelab/t18Av5-Ctjfh_wB8t-KpGiua4Zh9eB8-7A-3tXhliaU)

However this is extremely counter intuitive as you should just set the visiblity of guano to false.

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [February 6, 2020, 7:44pm UTC](https://forum.code.org/t/lesson-14-sound-add/32206/3 "2020-02-06T19:44:00Z")

</div>

@burnsk, Were you able to get it to work? Let us know if you still need any assistance on it.

Thanks!

Mike

---

<div class="post-metadata">

**Author:** ![burnsk](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@burnsk](https://forum.code.org/u/burnsk)\
**Post date:** [February 10, 2020, 11:24pm UTC](https://forum.code.org/t/lesson-14-sound-add/32206/4 "2020-02-10T23:24:39Z")

</div>

@mwood Yes thanks so much, the student was happy to see it work as they were hoping.
