Im making a game that involves players teleporting across different places. I’ve noticed that occassionally players will lose their save data. I normally use SetAsync until I read a post about how this is bad practice and I tried rewriting my script to use UpdateAsync instead but I got seriously confused.
What am I trying to do?
I have a folder of stats parented to the player that need to be saved.
What is the current script?
local function SaveData(ThePlayer, SaveSlot)
local StatsToSave = {}
local NewKey = "Player-ID:" .. ThePlayer.userId .. SaveSlot
print(NewKey.." datasaved")
for i,Stats in pairs(ThePlayer:FindFirstChild(Statsholder.Name):GetChildren()) do
table.insert(StatsToSave, Stats.Value)
end
DataBaseStore:SetAsync(NewKey, StatsToSave)
end
^ This is the current function being used to save data. How could I call this function to rewrite it using UpdateAsync?