# Function not working correctly!

**URL:** <https://forum.makecode.com/t/function-not-working-correctly/31050>\
**Category:** Help\
**Tags:** game, make\
**Created:** [October 7, 2024, 9:13pm UTC](https://forum.makecode.com/t/function-not-working-correctly/31050 "2024-10-07T21:13:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gravethecoder](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gravethecoder/32/17144_2.png) [@gravethecoder](https://forum.makecode.com/u/gravethecoder)\
**Post date:** [October 7, 2024, 9:13pm UTC](https://forum.makecode.com/t/function-not-working-correctly/31050/1 "2024-10-07T21:13:30Z")

</div>

Hey! Back again, For some reason when i call the function for the 3rd scene in my harry potter game it wont work, I wanna know if i coded this incorrectly. Help much appreitcated!

Link: [https://arcade.makecode.com/S45877-67163-35431-13651](https://arcade.makecode.com/S45877-67163-35431-13651)

---

<div class="post-metadata">

**Author:** ![gravethecoder](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gravethecoder/32/17144_2.png) [@gravethecoder](https://forum.makecode.com/u/gravethecoder)\
**Post date:** [October 11, 2024, 8:54pm UTC](https://forum.makecode.com/t/function-not-working-correctly/31050/2 "2024-10-11T20:54:27Z")

</div>

@richard may i have some help? ive been struggling with this still for a few weeks

---

<div class="post-metadata">

**Author:** ![ADM\_F](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/adm_f/32/19808_2.png) [@ADM\_F](https://forum.makecode.com/u/ADM_F)\
**Post date:** [October 11, 2024, 11:31pm UTC](https://forum.makecode.com/t/function-not-working-correctly/31050/3 "2024-10-11T23:31:10Z")

</div>

Im no richard but i can help!

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/7/4/7478494446caad633713c73536128eeeaf805263.png)  
Your calling the 3rd part BEFORE you clear everything So it creates the 3rd part then destroys it! all you gotta do is move it past the “destroy Shade” part and it works!  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/2/0/20dfc4c0f99bd7681b072eef158b3e59b9bc5c24.png)  
ALSO you have to add a light source Due to your Lighting Extension  
just add this to the end and it should work

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/e/d/eda8d490ca57925d5f2b8865c2855b255dfb0e10.png)

---

<div class="post-metadata">

**Author:** ![ADM\_F](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/adm_f/32/19808_2.png) [@ADM\_F](https://forum.makecode.com/u/ADM_F)\
**Post date:** [October 11, 2024, 11:31pm UTC](https://forum.makecode.com/t/function-not-working-correctly/31050/4 "2024-10-11T23:31:20Z")

</div>

Secondary unrelated notes

I like the Sprites  
recreating the book/movie is a neat idea

Last thing as any coder should know

if there is a problem there is a 99.999% chance its the coders fault not the engine or software
