Game variable is different in two places

Project link: Geometry Dash by jparesi

1-sentence description of the issue:

My son and I are trying to decrement hearts, but we can’t seem to get the variable to match in the game.

What do you want your code to do?

Right now we are debugging. The same variable is in two places, but the values are different, so obviously we don’t understand what we are ion. For this basic example, we want the two numbers on the screen to refer to the same variable.

What is the code currently doing?

Th code is showing the top textbox correctly but the bottom text in the square is always set to 0.

Bonus if you can also help show to square behind the bottom number instead of having the text completely replace the square.



Hello! What solutions have you tried already?


Hey! Welcome to the forum! I’ll try and look into the code and help, but I’m not sure if I understand the problem. I only see one use of that variable.


I also looked into the code and I could not see any other textbox than the one in the top right corner. The one in the top right corner looks like it works correctly just like you said.


hey there, i apologize if i’m misunderstanding whats being said in the op, but like @/William04GamerA mentioned, there arent any other texts in the project except the top right one.

you can notice you are decreasing the variable “Lives” after when the square finishes its animation. i suggest you to put it at the beginning of the container, so the player dont get confused why they are loosing one heart in mid game :))


Are you trying to use Local or Object variables instead of using Game variables? & What objects do you wan to have them reference the same variable?


I need a project to debug to debug it.


They did they sent a link


literally the first line of the post /lh


Hey! Thanks everyone for the quick replies. I tried to stop this from being posted, but since this is our first post, we had to wait for approval before removing the post.

My son and I were able to figure it out so we published the solution, which is all of you are not seeing our issue anymore.

To help those in the future, the issue we were having is we were putting a loop inside when the game is playing to check the value of the global variable. When we moved this to when the game starts, it started working.

I think this was just an issue of my son and I getting excited and trying to play around before we fully understood all the logic. We are going to watch some more videos before fiddling.

Again, thanks for everyone’s replies. We love that there is such a helpful community here.


awesome! super glad it’s been fixed :) feel free to tag me/anybody else if you have other questions! you can also read some nice and short tutorials in #ha category if you’d like :grin:

also, welcome to the forum :)


Great! If you or your son have any more questions, we’re here to help :))