Can anyone figure out why my save/load script won't work? I've tested it many times and can't figure out why it doesn't save...
game.Players.PlayerAdded:connect(function(plr)
local key = "user_"..plr.userId
plr1 = plr
data_points:UpdateAsync(key, function(oldValue)
local newValue = oldValue or 0
repeat
wait()
plr:FindFirstChild("Points")
until plr:FindFirstChild("Points")== true
plr.Points.Value = newValue
print"POINTS LOADED!"
--return newValue
end)
data_wins:UpdateAsync(key, function(oldValue1)
local newValue1 = oldValue1 or 0
repeat
wait()
plr:FindFirstChild("Wins")
until plr:FindFirstChild("Wins")== true
plr.Wins.Value = newValue1
print"WINS LOADED!"
--return newValue1
end)
while true do
wait(5)
data_points:SetAsync("Points", plr.Points.Value)
data_wins:SetAsync("Wins", plr.Wins.Value)
print'saved!'
end
end)
