Question about DataStoreService

Hello my fellow developers.
I have a question about DataStoreService. I currently don’t have the code since i need some advice on how to set it up.
I want to make a game like Trove (Non copyrighted of course), but i want to know if it is possible to set up a datastore that can easily handle the next list:

  • Atleast 10k+ Values
  • 100 Player Servers
  • Minimal to none dataloss.

I hope this is possible, because it is the reason why i started developing in the first place, If it isn’t possible, it would be very sad. But i hope anyone with some knowledge can provide me with some tips and tricks like:

  • What to know/do and what i shouldn’t do.
  • Best Practices.
  • etc…

I hope to hear from you, if not. Have a nice day.
BobbieTrooper.

I do think you can be able to save a high amount of values like that into a data store, however that depends on the values, their type and many other aspects. I am not a datastore engineer expert, but one trick I’ve seen is people use strings to save values on maybe a json encoded format. Strings length can get to like 200k characters or so, so maybe some approach of that sort could help you.

Well, I need so save a ton of stuff, Like a bunch of tools, alot of ‘other Playable Character with their own files’'. I don’t really know how to explain it.

You just need to know how to program it correctly. DataStores can already handle millions of values as seen in games like Adopt Me!. If at all, data loss is always tied to poorly structured code. You should use some good solutions to data storing such as ProfileService or my solution DataService which is a profile manager.

Please reach out to me if you need further assistance.

1 Like

The Total limit a DataStore can Save, is up to 4 Megabytes per key, which is roughly 4 million bytes, A Character is around 1 - 4 bytes.
The First 128 Unicode points in UTF-8 are 1 byte. We can look at the Unicode Points for specific Characters, for Example: English Letters, and Numbers:

Characters Unicode Point
Numbers ( 0 - 9 ) 30 - 39
A - Z ( Uppercase ) 65 - 90
a - z ( Lowercase ) 97 - 122

They are below that 128 limit.
You can also use string.byte or utf8.codepoint to get this information, or look at a Chart.


So overall, It would be Possible to Save a Large amount of Data without ever running into this limit, You just need to know how to handle your Data properly in order to prevent stuff like Data Loss, which can be prevented, or less likely to happen.

DataStoreService has a Limit on how many times you can send a request per minute, If you read the Limitations for DataStores, it should be about: 60 + (numPlayers × 10) requests per minute for both GetAsync and SetAsync, So if you have one Player, It is about 70 Requests you can Make in a Minute. You cant give an exact number as the number may vary for the amount of players in a game.

The Best Practices are more based on efficiency of your system, One of the Things that are commonly done to help with Getting / Saving Data is with the help of pcall(), pcall() will help you with preventing errors, and Handling them accordingly, this method is commonly used to check if the request sent to Get/Save Data fails and to retry if that happens.
Another Thing you can utilize is the BindToClose callback, this will have code fire when the Server is closing, and would be useful to ensure Data Saves when something happens like when Roblox Closes for maintenance, or Data failed to save for a Player.

There are many Resources out there like DataStore2, ProfileService. which will help you with these sort of things.