How to Datastore item existence count?

Hello!

Games like Pets Go keep track of how many items/pets that are in existence of that specific item/pet.
They then display to the player if they are the 1st, 25th or 5,210th person who got that item/pet.

How could I keep track of this information. In my head it feels like I would need to assign every item a UUID. Then you could have datastore key that only stores UUID references of that item. My only issue with this solution is that the datastore key limit is 4MB. It feels like storing millions of these would eventually fill up the 4mb threshold. For non rare items this would certainly fill up rather quickly.

So how could I got about implementing this without reaching this key limit?

2 Likes

Hello!

What you are looking for is an Ordered Datastore!

Here is also a beautiful video explaining it:

Wouldn’t I run into the same data related issue?
4mb really isn’t a lot when storing UUIDS.

Sorry, I am not familiar with the term UUID, could you please explain further?

Also, I wouldn’t say you would run into the same issue, since with ordereddatastores you can get a specific amount and it would still work, probably would be an issue if the specified amount is too large

As you can see with the image above, you can get a minimum and a maximum value in an ascending or descending order.

If I misunderstood something, please tell me right away!