script.Parent.Humanoid.Died:Connect(function()
local dss = game:GetService("DataStoreService")
for i, v in pairs(game.Players:GetPlayers()) do
if dss:GetOrderedDataStore("BossWins"):GetAsync(v.UserId) ~= nil then
dss:GetOrderedDataStore("BossWins"):UpdateAsync(v.UserId, function()
local value = dss:GetOrderedDataStore("BossWins"):GetAsync(v.UserId) + 1
print(value)
return value
end)
else
dss:GetOrderedDataStore("BossWins"):SetAsync(v.UserId, 1)
end
end
end)
so im trying to just save some data to an ordereddatastore, but for some reason its just not saving. i currently have 17 wins in this game, so the print statement prints 18. but if i were to kill the boss a second time, it would print 18 again instead of 19. this means the data isnt being saved and the game still thinks i have 17 wins. any idea why this is happening?