This works for my leaderboard but not for my attributes(Dex, Hp etc..) values. My output log says it's saved after leaving and loaded when I enter the game.
-- Saving game.Players.PlayerRemoving:connect(function(player) local datastore = game:GetService("DataStoreService"):GetDataStore(player.userId.."att") local statstorage = player:FindFirstChild("attributes"):GetChildren() for i = 1, #statstorage do datastore:SetAsync(statstorage[i].Name, statstorage[i].Value) print("saved data number "..i) end print("Att successfully saved") end) -- Loading game.Players.PlayerAdded:connect(function(player) local datastore = game:GetService("DataStoreService"):GetDataStore(player.userId.."att") player:WaitForChild("attributes") wait(1) local stats = player:FindFirstChild("attributes"):GetChildren() for i = 1, #stats do stats[i].Value = datastore:GetAsync(stats[i].Name) print("Att number "..i.." has been found") end end)