[Solved] My Global Variables for score no longer work

Basically what the title says. I have a text object called Score which has events attributed to it with actions that change the global variable to add points and to change the text of Score to GlobalVariableString(score), so that the score carries over to the next scene.

However, a few days ago while testing my game to test the levels that I’d created, I noticed that while it still adds up the score at the end of each scene, the score now resets itself every single time I change scenes. I’m guessing that it coincides with the latest GDevelop update, as these variables worked just fine prior to that and I haven’t made any changes to them, but I don’t know how to fix it. Advice would really be appreciated, as I’m finally reaching the point where I can put more focus into designing each level as opposed to scripting events.

Update:
So I was (somewhat) wrong. It does actually add up my score, but for some reason it initially shows zero at the beginning of each scene, only showing the score when I complete the level. I didn’t notice this initially since the scene changes immediately and only noticed now when I completed the final level. Have no idea why it doesn’t show the score at the beginning of each level.

Hey Hallow,

I’m pretty new to Gdevelop as well, but it almost sounds like you have a scene variable linked in with your global variables.

Without seeing your events it’s tough for a newb like me to figure out, but that’s about the only thing I can think of. I know you stated you were only using global variables, but it’s worth checking. Other than that it could be that your score isn’t updating with the previous variable that kept track of the last scene’s score.

So maybe looking at that portion and seeing if you have something stating that you are adding the variable to the total when displaying the score. Otherwise in my brain it makes sense that is only showing you the score for that level and adding it behind the scenes to a running total the player can’t see until the high score.

Best of luck you legend!

Include a Beginning of scene event that displays the score as the action. If that doesn’t fix it, then there’s something else afoot.

Very late update:

Sorry, I fixed the issue by myself shortly after posting this. All I had to do was put a “Change the text of Score” action at the beginning of the scene.

2 Likes

hi i have the same issue i know im kinda late but if you see this could you help?

Can you post the events?