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

That just means data stores are down.

That means you are not calling :Set or similar methods. The warning is pretty clear.

Are you on the latest version from GitHub?

Yes, I am using require(1936396537) to get the module

I am calling :Set , this issue arose about a day ago.

I’m getting the error static2240 is reporting, followed by the warning that the data store was not saved.

I’ve made no changes/modifications that could affect this, and it’s been working perfect for 5 months. Just yesterday I’ve been getting reports from players that the game is experiencing broken servers.

For every server I check that is broken, I am receiving the HTTP 503 (Service Unavailable) error, followed by a warning that Datastores are not updating.

1 Like

That isn’t the latest release. The free model is not updated anymore, and hasn’t been recommended in a long time. Please recheck the documentation.

Have you turned on API services? I had the same error, just forgot to turn it on.

Thanks for the reply!

Yes, I do have API services turned on. I am noticing that sometimes there are too many requests added to queue, but I am not sure what I’m doing to do that. Typically these warnings arise, followed by the HTTP 503 error, and then the Datastore failing to update.

I’m using :Set whenever data changes, but from what I read, this shouldn’t be the cause.

I’m using :Get() to get values and :Set() to change them.

Apologies for my potential lack of knowledge regarding DS2, but this issue really came out of no where and I’m stumped!

I am also getting errors of “503 Service Unavailable” for DataStore… and I don’t use DataStore2. Problems started happening about 1 day ago for no apparent reason. (My bad if I shouldn’t be posting this here). It also seems that the DataStore queue overfills too fast. It’s really odd.

I am also getting this error regarding "502: API Services rejected request with error HTTP 503 (service unavailable) causing user’s data to be wiped, I do not use DataStore2.

I made a separate thread here regarding HTTP 503 errors. This seems like an issue prevalent with both DS2 and non-DS2 users. Please post your experiences there if possible:

1 Like

hello, I have been working for a long time using the DataStore2 system, I basically already know how to use it, but lately a script of my “Quest” is not working before, it used to work normally …
it seems that for some reason it is not reading the increment part in the script, I can get the value of: Get () but I can’t change a value in the script using: Increment () and: Set ()

this is my script [Server Script] (It can be a bit confusing but I hope you can understand)

local DataStore2 = require(5159892169) --This is my module OBS: (Updated Version!)
local ConverValues = require(5084840082)

DataStore2.Combine("GameData_V1","Power","TotalPower","Rebirth")

local localplayer = script.Parent.Parent.Parent.Parent

--Remotes--
local Remote = script.RemoteEvent
local KilledDummy = game.ReplicatedStorage.Events.Giver_Event
local UpdatedPowerEvent = game.ReplicatedStorage.Events.Update_UIPower
local CompletedQuestEvent = game.ReplicatedStorage.Events.QuestCompletedEventGive
---------------

local QuestFrame = script.Parent.Parent.QuestFrame

local Kills = nil
local NumberKills = nil
local QuestDummy = nil
local DummyNameInQuest = nil
local GiverAmountPower = nil

local HaveQuest = false

Remote.OnServerEvent:Connect(function(player,DummyName,DummyNameQuest,ToKills,ValueToGive)
if player.Name == localplayer.Name then
local RebirthSave  = DataStore2("Rebirth",game.Players[player.Name])
QuestFrame:TweenPosition(UDim2.fromScale(1,0.95),'Out', 'Bounce', 1,true)
HaveQuest = true
GiverAmountPower = (tonumber(ValueToGive)*(RebirthSave:Get(0)+1))
QuestDummy = DummyName
DummyNameInQuest = DummyNameQuest
Kills = 0
NumberKills = ToKills
local TextQuest = "Kill "..ToKills.." "..DummyNameQuest.." to earn "..ConverValues:ConvertShort(GiverAmountPower)
QuestFrame.QuestInfo.Text = TextQuest
QuestFrame.QuestKills.Kill_Amount.Text = Kills.."/"..ToKills
QuestFrame.QuestKills.QuestBar.Size = UDim2.fromScale(0,1)
end
end)

function QuestFinished()
local random = math.random(250, 750)
local xnew = random / 1000
local new = script:WaitForChild("PowerGived"):Clone()
new.Text = "💪+".. ConverValues:ConvertShort(GiverAmountPower)
new.Position = UDim2.new(xnew, 0, 1, 0)
new.Parent = script.Parent.Parent
new:TweenPosition(UDim2.new(new.Position.X,0,0,0),'Out', 'Linear', 1)
QuestFrame:TweenPosition(UDim2.fromScale(1,1.95),'Out', 'Bounce', 1,true)
HaveQuest = false
GiverAmountPower = nil
QuestDummy = nil
DummyNameInQuest = nil
Kills = nil
NumberKills = nil
wait(4)
new:Destroy()
end

local function FinishQuest()
QuestFrame:TweenPosition(UDim2.fromScale(1,1.95),'Out', 'Bounce', 1,true)
wait()
HaveQuest = false
GiverAmountPower = nil
QuestDummy = nil
DummyNameInQuest = nil
Kills = nil
NumberKills = nil
end

script.FinishQuest.OnServerEvent:Connect(FinishQuest)

KilledDummy.Event:Connect(function(PlayerName,DummyKilledName)
if HaveQuest then
if PlayerName == localplayer.Name then
	if DummyKilledName == QuestDummy then
		Kills = Kills+1
		local TextQuest = "Kill "..NumberKills.." "..DummyNameInQuest.." to earn "..ConverValues:ConvertShort(GiverAmountPower)
		QuestFrame.QuestInfo.Text = TextQuest
		QuestFrame.QuestKills.Kill_Amount.Text = Kills.."/"..NumberKills
		local BarSize = Kills/NumberKills
		QuestFrame.QuestKills.QuestBar:TweenSize(UDim2.fromScale(BarSize,1),'In', 'Quint', 0.5, true)
		if Kills == NumberKills then
			local PowerSave  = DataStore2("Power",game.Players[PlayerName])
			local TotalPowerSave  = DataStore2("TotalPower",game.Players[PlayerName])
			PowerSave:Increment(GiverAmountPower,0) -- For some reason these lines are not being executed by datastore2
			TotalPowerSave:Increment(GiverAmountPower,0) -- For some reason these lines are not being executed by datastore2
			QuestFinished()
		end
	end
end
end
end)

this post has the ceritificate of awesome

@Kampfkarren
I discovered the problem that some players are “losing data” (IF IT LOOKS LIKE MY CASE), I was basically thinking that I was not saving my data, but after a while I found that if you call the function :Increment () or :Set () at the same time in two different scripts it will not save correctly, it has to have a cooling of at least 0.1 seconds, I did it in my script and it is working now !! I just don’t know why you’re not saving with two calls, because before I updated my module it was working normally, what I think is that something from the new update is interfering with that …
Hope this helps.
(Maybe this was just happening to me!)

1 Like

As stated by @Kampfkarren, the free model is not updated anymore. Please use the version from the link above, that says “Download”

Where can I find the paid version.

Please read the documentation. There is no paid version, just a new way of getting it.

so … just like i said before in the script … that module is updated, i downloaded it then export it to roblox.

I was looking through the threat to find posts related to GDPR Erasure and saw that you wrote:

clear(userId, name)

This is very helpful, but I’m a bit confused on what you meant by using this in the command bar? I have edited DS2 so that it can support NoLoading on top of NoSaving to simulate a new player, however, how would I use that command in the command bar? Would I need to copy and paste this into the command bar via Dev Console with userId being the players ID and name is the name of the stat (such as “Gold” or “Level”)?

Yes, that is how you can get the latest version.