I switched my whole game’s DataStore system a while ago to a more easy to manage and stable system that relies on UpdateAsync and tables.
I also switched my OrderedData to the new system.
Recently, my normal DataStore data doesn’t save after the player leaves, however it returns success, evidenced by the print statements.
However, the ordered data saves and updates normally.
Can anyone help me on this?
Regular data save code:
local function savePlayerData(player)
if sessionData[player] then
return dataStoreRetry(function()
local success = pcall(function()
playerData:UpdateAsync(dataKey .. player.UserId, function()
return sessionData[player]
end)
end)
if success then
print("Saved data for " .. player.Name)
end
end)
end
end
Ordered data save code:
local function orderData()
for _, player in pairs(Players:GetPlayers()) do
return dataStoreRetry(function()
local success = pcall(function()
playerOrderedData:UpdateAsync(orderedKey .. player.UserId, function()
return sessionData[player].TotalExperience
end)
end)
end)
end
end