[SOLVED] Firebase, y u no work?!

Hello GDevelop experts lurking in the forums. A newbie like me needs you to shine your knowledge down upon me once more.

My firebase document is not creating/saving any data and thus, my leaderboards are not working as intended. Allow me to explain. This will be long because I want to be as elaborated as possible.

I followed the Leaderboards tutorial from The Gem Dev AND the official GDevelop wiki tutorial here: Adding realtime leaderboards to a game [GDevelop wiki]

Heck, I even copied the events from GDevelop’s official Leaderboards example: GDevelop 5

And right now, this is how my event sheet looks like:

From the game screen:

From the leaderboards screen:

In terms of saving names and scores, everything works fine.
BUT once a player submits their score to the leaderboard, this is where the problem starts:

  1. Only one name and score will appear at a given time:

  2. And my firebase document is not creating any data:

In comparison…this is how The Gem Dev’s Firestore Database looks like:


…well… It worked for him…

So what am I doing wrong here?
Could it be my Firebase Configuration String? I don’t think so…
Screenshot (14)

I don’t see any mistakes…

How about the Firestore Database Rules? I copied it from GDevelop’s official wiki tutorial, so I don’t think there would be any mistakes here:


So… Why is my firebase leaderboards not working the same way The Gem Dev’s tutorial worked??
Heck, why isn’t it working the way the official GDevelop’s Leaderboard example worked?: GDevelop 5

Your help would be greatly appreciated if you could solve my problem here.
Many thanks in advance…

I’m other child in this large run… But in edit rules the data.name.size () > 1 isn’t 10? for example…

APPARENTLY I’VE SOLVED THE ISSUE.

I could simply delete this thread, but I decided to just leave this thread here with the solution in hope that it could help others facing the same issue as I did.

So the solution here comes to the RULES of the firebase itself
Especially the collection name which on the rule, did not match with the events I placed in my GDevelop game. I overlooked this little detail which caused firebase to fail to create/save a document for my leaderboards.

Based on my screenshots above, the sample firebase rules that GDevelop placed are as follows: match /scores/{document} {
Fourth row from the top.

This implements that the name of the collection you placed in the events AND the name of the collection in Firebase has to also be “scores” for it to work.

My mistake was that I labeled my collection in the events and on Firebase as “Leaderboards” instead of “scores” which clashed with the rule.

So in my situation, there are a choice of 3 solutions I could do to rectify:

  1. Rename all my collection labels in the events and the collection name on Firebase from “Leaderboards” to “scores” so it corresponds with the rules.
  2. Change the rule on the fourth row from “match /scores/{document} {” to “match /Leaderboards/{document} {”
  3. Entirely use a new word to be implemented on the said rule, Firebase collection name and the collection name in your events. As long as it’s just one same word with matching spellings.

I find solution 1 to be the safest as to not temper with the rules too much (but all of it will work equally) and implemented that. And voila, problem solved, my leaderboard is finally saving name and scores.

Alright, a forum mod may close this thread now.

1 Like