So say this is my data that I would like to store, now I've read the info on the wikis about failures but since this doesn't auto save, how would I make sure a player gets notified that their data may not save? Should auto saving be implemented or not? And how would I make it so that if, in fact, the data may not save that it doesn't overwrite the players save file? Not understanding how to do this.
local ds = game:GetService("DataStoreService"):GetDataStore("stats")
statz={"Kills","WOS","Noobs"}
game.Players.PlayerAdded:connect(function(plyr)
local a=Instance.new("NumberValue")
a.Parent=plyr
a.Name="leaderstats"
for i=1,#statz do
local stat=Instance.new("NumberValue")
stat.Parent=a
stat.Value=0
stat.Name=statz[i]
end
local child=plyr.leaderstats:GetChildren()
for i=1, #child do
child[i].Value=ds:GetAsync(plyr.userId..child[i].Name)
end
end)
game.Players.PlayerRemoving:connect(function(plyr)
local child=plyr.leaderstats:GetChildren()
for i=1, #child do
child[i].Value=ds:SetAsync(plyr.userId..child[i].Name,child[i].Value)
end
end)

2 comments
Thank you, can you please PM me on roblox or twitter?
Contacted you via roblox DM