Hi, I've tried to make a save script using UpdateAsync, and it doesn't save. I've added two prints that can help me troubleshoot (print("operation start") and print("operation end")), and the script just prints, "operation start" and nothing else. The table isn't nil or empty. Any help (including tried but doesn't work) will be appericated! I've tried looking at the DevForum and asked at RoDevs Discord. I have my game "Enable Studio Access to API Services" enabled.
Here's this thing that's been bugging me. (It's inside of a huge script (where events PlayerAdded and PlayerRemoving are) and I can't copy and paste this huge thing, otherwise it will take time for you to analyze.)
function saveData(plr)
local function updateAsync(givenDatastore, givenKey, givenValue)
print("operation start")
local s, e = pcall(function()
if givenValue then
givenDatastore:UpdateAsync(givenKey, function(rawOld)
local cookedOld = rawOld or starterData
if givenValue.dataId > cookedOld.dataId then
givenValue.dataId += 1
return givenValue
else
return cookedOld
end
end)
end
end)
print("operation end")
if s then
print("All is fine!!")
else
warn(e)
end
end
local savedData = {}
local folder = plr.data
for _, object in pairs(folder:GetChildren()) do
if object:IsA("Folder") then
else
savedData[object.Name] = object.Value
end
end
updateAsync(playerDatastore, plr.UserId .. "-p", savedData)
end
Here's what the output tells me:
Expectations: https://ibb.co/J21tv39 Reality: https://ibb.co/m8QFN8N
