Hi guys!
When a player leaves from my game, I want to save their stats.
However, for some reason, only the first few saves actually proper save. I have a feeling this is because when the player has left the Data can't save?
So, is there anyway to run all these saves at the same time so that they can all save properly? :) Thanks!
SAVING:
local function save(player,name)
local folder = player:FindFirstChild(name)
local data = {}
for k,v in pairs(folder:GetChildren()) do
data[v.Name] = v.Value
end
for i=1,3 do
if pcall(DS.SetAsync,DS,player.userId.."_"..name,data) then
return print("BACKEND HANDLER: Data saved successfully for",player)
end
end
warn("BACKEND HANDLER: Couldn't save data for",player)
end
Players.PlayerRemoving:connect(function(plr)
saveplayerdata(plr,"Traps")
save(plr,"PlayerMapTimes")
save(plr,"PlayerModel")
saveplayerdata(plr,"TwitterCodes")
saveplayerdata(plr,"Equipped")
saveplayerdata(plr,"Achievements")
end)

1 comment
OK, thanks! I have edited the post to contain my saving :) Any suggestions to edit it specifically?