My save script has been working just fine for months. Yesterday morning, no issues at all. I made no changes to the game at all, didn't even open Studio. Checked the game several hours later and now the save script is no longer working.
What does save: *Silver *Salvage *RescuePoints *Rebirth
Nothing in the backpack appears to be saving, all tools, skins and pets are reset upon logging back in. It works in Studio, but not in live. I can't figure out why it just suddenly stopped working. No errors are being reported and the script still prints everything out like normal.
local DataStore = game:GetService("DataStoreService"):GetDataStore("DCS23Silver")
local DataStoreSal = game:GetService("DataStoreService"):GetDataStore("DCS23Salvage")
local DataStoreBac = game:GetService("DataStoreService"):GetDataStore("DCS23BackpackW")
local DataStoreCon = game:GetService("DataStoreService"):GetDataStore("DCS23ConName")
local DataStoreConAm = game:GetService("DataStoreService"):GetDataStore("DCS23ConAmount")
local DataStoreCol = game:GetService("DataStoreService"):GetDataStore("DCS23ColName")
local DataStoreReb = game:GetService("DataStoreService"):GetDataStore("DCS23Rebirth")
local timePeriod = 64800
local DataStoreTot = game:GetService("DataStoreService"):GetDataStore("DCS23Total")
-- Number of times we can retry accessing a DataStore before we give up and create
-- an error.
local DATASTORE_RETRIES = 3
--Retry System
local function dataStoreRetry(dataStoreFunction)
local tries = 0
local success = true
local data = nil
repeat
tries = tries + 1
success = pcall(function() data = dataStoreFunction() end)
if not success then wait(1) end
until tries == DATASTORE_RETRIES or success
if not success then
error('Could not access DataStore! Warn players that their data might not get saved!')
end
return success, data
end
local toolList = {}
local serverStorage = game:GetService("ServerStorage")
local toolFolder = serverStorage:WaitForChild("Tools")
for _, tool in pairs(toolFolder:GetChildren()) do
toolList[tool.Name] = tool -- tools must have different names else it will be overwritten
end
sessionData = {}
game.Players.PlayerAdded:connect(function(player)
local key = "key.."..player.userId
local currentTime = os.time()
sessionData[key] = true
---***---
local plrData = DataStoreTot:GetAsync(key)
local success, save = dataStoreRetry(function() return DataStoreTot:GetAsync(key)
end)
if not success then
print("Error on DataTot")
sessionData[key] = false
elseif not save then
--**--
print("Checking for Old Save Data")
--Silver
local success, save = dataStoreRetry(function() return DataStore:GetAsync(key)
end)
if not success then
print("Error on Silver")
sessionData[key] = false
elseif not save then
print("No Saved Silver")
silver = {cash.Value}
else
print("Loaded Saved Silver")
cash.Value = save[1]
end
--Salvage
local success, saveSal = dataStoreRetry(function()return DataStoreSal:GetAsync(key)
end)
if not success then
print("Error on Salvage")
sessionData[key] = false
elseif not saveSal then
salvage = {cash2.Value}
else
cash2.Value = saveSal[1]
end
--Container Amount
local success, saveCon = dataStoreRetry(function() return DataStoreCon:GetAsync(key)
end)
if not success then
print("Error on Container Amount")
sessionData[key] = false
elseif not saveCon then
container.Value = "Container"
containerAmount = {container.Value}
else
container.Value = saveCon[1]
local successAM, saveAm = dataStoreRetry(function()return
DataStoreConAm:GetAsync(key)
end)
if not successAM then
print("Error on Saved Amount")
sessionData[key] = false
elseif not saveAm then
else
containerAmount = saveAm[1]
end
end
--Color
local success, saveCol = dataStoreRetry(function()return DataStoreCol:GetAsync(key)
end)
if not success then
print("Error on Color")
sessionData[key] = false
elseif not saveCol then
colorName.Value = ""
color = {colorName.Value}
else
colorName.Value = saveCol[1]
end
print("No Save")
else
print("Loaded Save")
print(save[1]," ",save[2]," ",save[3]," ",save[4]," ",save[5]," ",save[6]," ",save[7],"
",save[8])
for index, data in ipairs(save)do
end
cash.Value = save[1]
cash2.Value = save[2]
container.Value = save[3]
containerAm.Value = save[4]
colorName.Value = save[5]
rebirth.Value = save[6]
rewardTime.Value = save[7]
RPoints.Value = save[8]
end
--Backpack
local success, saveBac = dataStoreRetry(function()return DataStoreBac:GetAsync(key)
end)
local backPack = player:WaitForChild("Backpack")
if not success then
print("Error at backpack")
sessionData[key] = false
elseif not saveBac then
print("No saved backpack found")
else
for _, tool in pairs(saveBac) do
--print("Tool Checking",player.Name,tool)
if toolFolder:FindFirstChild(tool) then
local toolCheck = backPack:FindFirstChild(tool)
if toolCheck == nil then
toolFolder[tool]:Clone().Parent = player.Backpack
elseif toolCheck ~= nil then
tool:Destroy()
end
print(player.Name,tool)
end
end
end
end
local x2 = backPack:FindFirstChild("x2")
if x2 then
local sellAmount = backPack:FindFirstChild("SellAmount").Value
sellAmount = 2
end
--Rebirth
print("Rebirth Checking Now")
local success, saveReb = dataStoreRetry(function() return DataStoreReb:GetAsync(key)
end)
if not success then
print("Error on Rebirth")
sessionData[key] = false
elseif not saveReb then
else
rebirth.Value = saveReb[1]
print(rebirth.Value,"Rebirth Value")
end
if rebirth.Value == 1 then
print("Rebirthed!")
wait(1)
player.Backpack.StoneAxe:Destroy()
local quakeAxeCheck = player.Backpack:FindFirstChild("StoneAxeQuake")
if quakeAxeCheck then
quakeAxeCheck:Destroy()
end
local StoneAxeQuake = game.ServerStorage.Tools.StoneAxeQuake:Clone()
StoneAxeQuake.Parent = player.Backpack
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local key = "key.."..player.userId
local silver = {player.leaderstats.Silver.Value}
local salvage = {player.leaderstats.Salvage.Value}
local container = {player.container.ConName.Value}
local containerAmount = {player.container.conAm.Value}
local color = {player.container.ColorName.Value}
local rebirth = {player.container.Rebirth.Value}
local rewardTime = {player.container.RewardTime.Value}
local saveTable = {player.leaderstats.Silver.Value,
player.leaderstats.Salvage.Value,
player.container.ConName.Value,
player.container.conAm.Value,
player.container.ColorName.Value,
player.container.Rebirth.Value,
player.container.RewardTime.Value,
player.leaderstats.RescuePoints.Value}
print(sessionData[key],"removing")
if sessionData[key] then
print("Saving")
dataStoreRetry(function() return DataStoreTot:SetAsync(key,saveTable)end)
local saveList = {}
for _, tool in pairs(player.Backpack:GetChildren()) do
table.insert(saveList, tool.Name)
print(tool)
end
print("Saving tools")
dataStoreRetry(function()return DataStoreBac:SetAsync(key,saveList)
end)
end
game:BindToClose(function()
print("Shutting Down")
wait(20)
print("Done")
end)
function onSaveToolsEvent(player)
local key = "key.."..player.userId
local saveList = {}
for _, tool in pairs(player.Backpack:GetChildren()) do
table.insert(saveList, tool.Name)
--print(tool)
end
if sessionData[key] then
return dataStoreRetry(function()return DataStoreBac:SetAsync(key,saveList)
end)
end
end
saveToolsEvent.OnServerEvent:Connect(onSaveToolsEvent)

3 comments
depends on whether or not the game is in Experimental Mode, check if Filtering Enabled is set to true or check marked, then i can replicate this and make this work with steps to achieving this with a fix to your question.
Filtering Enabled is set to true
After more testing I've isolated the issue down to line 158, but I can't figure out what's going on. Upon joining the game, it correctly prints out everything that ought to be in the backpack, so clearly it is saving... but it isn't cloning those items back into the backpack. You can still purchase tools from the shop, which uses that exact same line of code.