How to use DataStore2 - Data Store caching and data loss prevention

Im having trouble with data loss. It happens whenever a player got disconnected by internet connection. So i have to save player data every 1 minute. Am i right to do this?

Saving data recurrently is fine, but are you on the most up to date DataStore2 (NOT the free model)?

Very impressive! Just found this. If i understood this correctly, all errors are handled? So i dont need to wrap anything in a pcall right?
Also, nothing needs to be attached to the function before the server shuts down right?

If i just update the data whenever i need to, can i be 100% sure that the data will be saved when the player leaves?

SaveAll has a chance to error, but Get/Set don’t.

No.

Yes.

I made a plugin for this module its still in progress since its my most complex plugin i made. But how it works u just connect to a datastore “Dataname/userid” and press connect button.
On the buttom of the connect screen there is the current datastore key but you can use your desired key like 1,2,3…etc. Once you put the key press enter and you will get a table with everything you stored inside the data key. You can edit or add or remove something from it. Then you can save(every 10 seconds so you dont overload the data). Thanks.
Datastore Link: Datastore2 Editor - Roblox

1 Like

How would I appropriately use SaveAsync() and determine if data sucessfully saved? This is my current snippet of sample code:

InventoryStore:Set(Inv)
local success, errorMessage = pcall(function()
	InventoryStore:SaveAsync()
end)
	if not success then
		print(errorMessage)
	end

Many people have started getting errors with DataStore2. We don’t know if it is Roblox issue or DataStore2 issue, but it is definitely not an issue on our side.

The error:
HTTP Unknown Error (TlsVerificationFailed)

This happens whenever player quits the game. The game freezes for 20-30 seconds and this error comes out.

That is definitely not a DataStore2 issue.

That looks right to me, though be cautious about how much you save.

I’ll put bug report topic here.

And announcement too.

For the past 2 months, I’ve been trying to resolve an issue in my game where DataStore2 causes Studio to return the error Script with BindToClose callback was destroyed; callback cannot be called!
This is causing the data not to save. Any ideas as to how to fix this or what is causing this?

Are you using the latest version from GitHub?

Also, where is your DataStore2? A script should never be destroyed unless you are dong something weird, like putting it inside a tool or something.

Yes, I am using the latest version
DataStore2 is inside ServerScriptService

Edit: In case it wasn’t clear, DataStore2 has been on the correct version and in ServerScriptService even before this issue began

First of all, sorry if this has been asked a thousand times.
I can’t seem to find a answer for my problem, at least one I understand…

In my game, the player is able to create custom data.
Which is:
image_2022-06-23_190255105

The player created the folder name, and the values.
So in theory there can be 100 folders, each having those 3 StringValues, which have unique player chosen values.

My question is, how do I save the entire “Videos” folder.
I’m still trying to figure out DataStore2, so I’m sorry if this is obvious.

Sorry for bothering.

You’ll need to map it with your code into inputs for the datastore.

I don’t understand this question

I am immature in speaking English.
I want to know how to save at any time

The tutorial linked in the first post is a really good way to jump into this.

1 Like

DataStore2 is being used in two places in the same experience, would that be part of the issue? I do not see why it would, but I don’t have any better guesses.

Edit: I got it figured out. If anyone else has this issue, just read through issue #135 on the GitHub repository

I’m somehow getting this error? pls help
image
image

1 Like