# Help with Final Project - score showing too early

**URL:** https://forum.code.org/t/help-with-final-project-score-showing-too-early/38076
**Category:** Coding and Debugging Help
**Created:** [May 8, 2023, 1:11pm UTC](https://forum.code.org/t/help-with-final-project-score-showing-too-early/38076 "2023-05-08T13:11:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![maria.morin](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@maria.morin](https://forum.code.org/u/maria.morin)
#### Post date: [May 8, 2023, 1:11pm UTC](https://forum.code.org/t/help-with-final-project-score-showing-too-early/38076/1 "2023-05-08T13:11:34Z")

</div>

Hello!  
I have a few students working on their final project, creating a stickman survival game. They are having trouble with the score showing up too early and continually counting. What they would like to show is after the user presses play, the score will appear on the game page which begins in a bathroom. The score will continually count as the stickman stays alive. They have tried putting the code in several places but either it counts from the beginning without user input or the score will show on screen but the user cannot play the game. Any assistance would be apprecated!

Thank you,  
Maria

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

---

<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: [May 8, 2023, 3:22pm UTC](https://forum.code.org/t/help-with-final-project-score-showing-too-early/38076/2 "2023-05-08T15:22:43Z")

</div>

@maria.morin,

There are a number of ways to accomplish this. One might be more work, but ultimately might be the best and that would be to create multiple functions that control the game play and then use the draw loop to call them. That would require refactoring the game and may take some time.

Another would be to create a variable, something like “started” and set it to false at the beginning.

Then, when the play button is pressed, the variable could be set to “true”. Then, the code that updates the score could be set inside a conditional so it would only run if “started==true”.

Give that a shot and let us know if something isn’t working out.

Good luck!

Mike

---

<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: [May 8, 2023, 3:26pm UTC](https://forum.code.org/t/help-with-final-project-score-showing-too-early/38076/3 "2023-05-08T15:26:25Z")

</div>

Also, one more thing I noticed … Near line 128 or so, there is a conditional checking to see if sign.x = 5000… make sure you use triple = (===). A single = is the assignment operator and you need == or === when comparing items inside a conditional loop.

Mike

---

<div class="post-metadata">

### Author: ![maria.morin](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@maria.morin](https://forum.code.org/u/maria.morin)
#### Post date: [May 9, 2023, 12:15pm UTC](https://forum.code.org/t/help-with-final-project-score-showing-too-early/38076/4 "2023-05-09T12:15:33Z")

</div>

Mike,  
Thank you so much! Creating the variable and setting to true worked perfectly. The boys thank you for your help!

Maria
