Help me gdevelop-firebase

Here’s what I have working:

:green_circle: I’m already saving the coins to Firebase Realtime, and that part works fine.
:green_circle: I have a global variable called MonedasTotales.
:green_circle: While I’m in the game, the coins update live in the app and also update in real time on Firebase.
:green_circle: The text in the menu that shows the coins also updates correctly as I collect more coins.

The problem is this:

:red_circle: When I close or restart the app, the coins don’t get loaded from Firebase.
:red_circle: So when I come back, the “coins” text shows 0, and the MonedasTotales variable is also 0.
:red_circle: Since that variable is now 0, when I collect coins again, it saves that new value and overwrites what was already in Firebase, so I lose the previous amount (for example, if I had 7 coins in Firebase, it gets erased and replaced with the new value).


Hello and welcome. In your beginning scene event, you are getting the player coin value MonedasTotales from Firebase and storing it into a variable called temp. Then you overwrite the variable temp with the value of the game variable MonedasTotales, which is probably 0 since the game just started. Try instead to overwrite the value of the game variable MonedasTotales with the variable temp that you had just stored the value of MonedasTotales from Firebase into.

Friend, I don’t understand very well, since I’m new to gdevelop, can I talk to you, do you have discord or telegram friend?

Yo! having scene variable does not save so get your self global variable that saves well and loads well try it n lemme me know

Hello again. I should have given you an example. I meant try to change this:

into this:

Friend, I already have the global variable, but it won’t let me put it in the Firebase reading section.

I already did that and it doesn’t work either.I already did that and it doesn’t work either.

Hello, hmm. Then I’m not sure what it could be. Are you giving it enough time in the Beginning of scene events to get the value from Firebase?

you need a result state variable when you retrieve data from firebase. don’t run your code until the state variable = “ok”