I have been with my game but I have a problem yesterday I tried it in the studio and I had a data loss due to a bad internet and it was saved but I did not load what was saved, those who do know will realize that SetAsync saves by force. and GetAsync obtains the data but it has a time limit and if in that time it does not load due to a bad connection it does not load and SetAsync takes action saving an invalid value (a lost value)
Here I will leave you a script which I do not ask you to modify but rather tell me how I should use Pcall funtion etc… The point is that they promote me in case you are a very noble person without a doubt I would accept the modified script:
function saveData(player)
local charactersList = {}
for i, character in pairs(player.OwnedCharacters:GetChildren()) do
table.insert(charactersList, character.Name)
end
ds:SetAsync(player.UserId .. "Characters", charactersList )
game.ReplicatedStorage.OriginalCharacters[player.Name]:Destroy()
end
In summary I want the server to detect if the folder has no children and if it does not have children then it should not save it (using updateAsync) the folder is: “OwnedCharacters” you can see it in the for loop part
I got the script from a youtuber but I modified it to my style it cost me a lot hahaha
if you have doubts ASK ASK ASK PLEASE WITHOUT FEAR WHEN YOU DON’T KNOW SOMETHING PLEASE ASK