Trying to make a game with every item having it's own serial number (i.e roblox limiteds)

  1. What do you want to achieve? I want to make a game where each item has it’s own serial number, so when a player buys an item it’s serial number would be one above (+1) of the last one.

  2. What is the issue? I want this on every item, and am not sure how to do it without overloading a datastore, or calling too many times, or when two players buy the same item at the same time or within seconds of each other, resulting in two of the same serial numbers.

  3. What solutions have you tried so far? I looked for solutions on the devforum but I couldn’t find exactly what I was looking for. The only solution I have is that it wouldn’t be for every item and only on the expensive ones, but that’s not my goal

Interesting. I would come up with a queue system, every minute (or some time of your choice, possibly shorter), load all the limiteds into a queue, and then save them all to said data store, but save the time they were bought, so you can compare to determine which is earlier and later.

This solves your ordering problem, AND your overloading problem.

1 Like

But that means the person can’t immediately know what the serial number is if the datastore hasn’t updated and ordered yet

1 Like

Well, if you save it too frequently, you run into the same problem.

There is no way to know, you would have to instantly retrieve and compare data right then and there. This means that you would do that same thing every time someone buys a product.

The only way to not overload the system is to just do it less. You’ll have to improvise, like tell the player it’s “loading”.

1 Like

Honestly, I might connect it to an external database instead of datastore, it should lower bottle necks

1 Like

I’m trying to understand the main goal behind it. If we would like to create atomic database model we will assign one id to certain product and then reference to it in every player’s owned items. In other way, our database would be overloaded by useless repetation of the same values. But Roblox database is not relational-based, so there’s not a way to reference to another pieces of data and then concatinating them together.

If you want to make something that’ll make player’s item unique in sort of other items, you can make for example transaction identificator, formed in: item code, date of purchase, player’s id or some different type of data hovewer it’s important to keep format something unique. In that way, you’ll need more pieces of data to achieve the same thing, but it will be easier to declare and to verify and process it later in game.

Or just like sfgij said - you can connect it to external database system and then you can manipulate your data in more flexible way.

2 Likes

Yeah, especially for projects like these that require almost instant updating of data, I would invest in an external database or use googles one for free (Firebase I think) I currently use https://ionos.com for my databases and haven’t had a single issue and its pretty fast. Also, I would send the Unix timestamp when generating serial numbers (can give the user a time of creation + can be used for more accurate generation when multiple serials are created. Then every week or so I would use a program to make sure the timestamps are matching up with the serial for example:

If an item has a serial number of 1 but was made at 7:58 but another one has a serial number of 2 but was sent at 7:57 I would make it, so it switches the serials.

2 Likes

Pure speculation of an idea on my part but
Use MessagingService for cross server communication, create a queue and send the details of the item, player and time of purchase to a dedicated Roblox server assigned the privilege of data writing.
And/or use MemoryStores

MessagingService takes time to send data across all servers live, plus it doesn’t return a value if the message were send correctly which is important to keep data safe and uncollidable with another. Also in my opinion MemoryStores shouldn’t be used to store player’s data. Its the best usage is highlined in the linked article. Fact its fast and can handle frequent data updates doesn’t mean it should be used to handle players data.

1 Like

Communicating with an external source would be slower due to verification right?
Only other method I can think of is disabling the UseCache property

1 Like

I used verification on my external databases and still they are super fast when I update it from my panel I get reported speeds of 0.01 seconds or smth like that

Good point, however data which have been sent to external service are directly processed by it and only thing we have to do is to get response from the service itself if everything went well. After messagingService we’ve to post data to datastore, and if something went wrong during saving data, we’ve issue with information that was sent by messaging service become inaccurate.

1 Like