Hi, I am in the middle of developing a game. I just started to make my data store system and was wondering how safe is data store really? How often do data stores fail, data loss happen etc? Is this a common issue or not really?
What big games use «normal» data stores?
And I heard about somethibg called DataStore2, but there are almost no tutorials on how to use it nor did I understand the dev forum post on DataStore2.
So, in short.
Is it safe to use normal data store or should I use DataStore2, and if I need to use DataStore2 are there any good tutorials out there?
Thank you, I would appreciate an answer very much.
I personally don’t recommend DataStore2 as it cams up data, if you play datastores safe and not dependent on the function game.Players.PlayerRemoved itself an add a secure game closing function
game:BindToClose(function()
for _,player in pairs(game.Players:GetPlayers()) do
DataStoe:SetAsync(player.UserId, data)
end
end)
This function makes sure when an instance is closed and player removing isn’t called it will make sure all players data is saved and prevents large amounts of data loss what datastoe2 does very poorly.
There are 6 second cooldowns on Get/Set/UpdateAsync. So how do games do this? If they have to wait 6 seconds, how can they save data on the server close even though it takes a minimum of 6 seconds every time they want to save data?
This is just wrong. There have been no recorded instances of player loss in games that use Datastore2 with thousands of players. Using :SetAsync() also may lead to data loss.
To answer OP’s questions, you should absolutely use Datastore2, as it uses one of the best saving methods. Here’s a good tutorial on it, and you need help, just ask. Good luck!
AlvinBlox’s tutorial was helpful, but you don’t need to use at, as there are other ways of learning it.
I’m not sure how that link proves your point. Datastore2 also uses BindToClose. Did you read this article? If you haven’t, you should. It would explain why your way isn’t a good way of saving data.
Even if Datastore2 did use SetAsync, your method would lose data, and Datastore2 will not. I don’t think I’ll be replying anymore as I have already repeated my point multiple times.
From where do you have the information from? Did you read code of the module to know all of this or is it just assumption?
E1: DataStore2 indeed uses only SetAsync, but it still is no problem since there is under 1% of reported failures in saving/retrieving data. I also experienced no lag whatsoever on a stress test I did once on the server.
This may be your opinion, but for others his videos can be useful.
The entire point of DataStore2 is to avoid data loss. It saves new data without overwriting the old in order to be able to retrieve the old saves in case something goes wrong. Your point is invalid as it has no negative impact for the developers, it’s only an issue for Roblox as they need more storage, but that’s what they get for giving us no reliable servers or data loss management.
:SetAsync() can and will fail during high loads, the same goes for :GetAsync(). This is also why Roblox themselves discourage the use of :SetAsync() in favor of :UpdateAsync().
If you’re afraid of using DataStore2, you should use UpdateAsync() in place of SetAsync() which could lose data and not account for older data. DataStore2 is also a good alternative if you want to use that to save data as it keeps backups and could be used in case of an emergency.
This is incredibly incorrect. Please don’t make definitive statements about things that you clearly do not understand.
There are significant (and undocumented) issues with using DataStores the way the developer hub wants you to, and many of these issues start getting very pronounced when trading, teleportation between places or other variables are introduced to your game.
DataStore2’s usage of SetAsync instead of UpdateAsync makes perfect sense, as it is writing to a brand new key for each save instead of overriding data on a previous key.
There is so, so much that can (and has) gone wrong with DataStores. Storing all of your players’ precious data on a single key is negligent. A lot of what DataStore2 does is “not pretty”, but it’s there because it’s the best solution to definitively solve many of the issues that come up when you override DataStore keys.
@Oficcer_F you should see this thread about the issues with DataStores and why developers are resorting to crazy measures to get additional functionality/protection out of the feature:
You really, really don’t want to be doing this. Generally you want all of your data for a player to be stored in the same place, or else you run a very high risk of players either buying something and not getting the item or buying something and not losing any money due to a datastore saving issue where only one successfully saves.
You can think of different data-stores(service:GetDataStore()) as different folders. Inside everyone of these folders there are keys pointing to a JSON formatted string. Now why would you store the gems and coins in one folder, all while keeping the weapon and skins in another?