Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My Ordered Data Store Isn't Saving the Data?

Hey everyone, this is my first time using ordered data store. When I am trying to save the data, I get the Warn Data Couldn't be saved I don't know what im doing wrong?

 local theStatsDataStore = game:GetService("DataStoreService"):GetOrderedDataStore("theStats")

game.Players.PlayerAdded:Connect(function(player)
	local Exp = player:WaitForChild("theStats").Exp
	local Levels = player:WaitForChild("theStats").Levels
	
	local theData
	local success, theError = pcall(function()
		theData = theStatsDataStore:GetAsync(player.UserId)
	end)
	
	if success then
		if theData ~= nil then
			Exp.Value = theData[1]
			Levels.Value = theData[2]
		else
			print("No Data")
		end
	else
		warn("Data couldn't be loaded")
	end
end)



-- save the data
game.Players.PlayerRemoving:Connect(function(player)
	local tableToSave = {}
	table.insert(tableToSave, player.theStats.Exp.Value)
	table.insert(tableToSave, player.theStats.Levels.Value)
	local success, theError = pcall(function()
		theStatsDataStore:SetAsync(player.UserId, tableToSave)
	end)

	if success then
		print("Data Succesfuly Saved!")
	else
		warn("Data couldn't be saved")
	end
end)

1 answer

Is your error like a warn that prints something like "Further requests will be dropped"?

2 comments

0

Not the one you set, but are you getting that?

0

I am only getting the one that i set, not the furthers requests will be dropped

This discussion is preserved as it was. New answers, comments, and votes are closed.