The DataStore I made always saves but earlier today, it didn't. I'm super curious to figure out why but I couldn't think of anything. Can someone help me figure out why it would fail like that?
game.Players.PlayerRemoving:connect(function(player)
local datastore = game:GetService("DataStoreService"):GetDataStore(player.UserId.."Save")
local statstorage = player:FindFirstChild("Currency"):GetChildren()
for i = 1, #statstorage do
datastore:SetAsync(statstorage[i].Name, statstorage[i].Value)
print("saved data number "..i)
end
print("Stats successfully saved")
end)
game.Players.PlayerAdded:connect(function(player)
local datastore = game:GetService("DataStoreService"):GetDataStore(player.UserId.."Save")
player:WaitForChild("Currency")
wait(1)
local stats = player:FindFirstChild("Currency"):GetChildren()
for i = 1, #stats do
stats[i].Value = datastore:GetAsync(stats[i].Name)
print("stat numba "..i.." has been found")
end
end)

2 comments
Did you make an update to it and then it stopped working? Are there any errors or warnings or anything in output?
I didn't change anything about it. And no, they isn't any errors or warnings.