I'm having a bit of trouble understanding what I should do for loading the Values from the Datastore table to the actual IntValues in the players leaderstats.
I'm really new to Datastores so if you could please break it down for me I would really appreciate it!
local ds = game:GetService("DataStoreService"):GetDataStore("PlayerStats2") local getStats = Instance.new("BindableFunction") getStats.Name = "getStats" getStats.Parent = script function saveStats(player) local statz = player:FindFirstChild("leaderstats") local stats = statz:GetChildren() if stats then local statsTab = {} for i,v in pairs(stats) do statsTab[v.Name] = v.Value end ds:SetAsync(tostring(player.UserId), statsTab) end end function getStats(player) return ds:GetAsync(tostring(player.UserId)) or {} end --**What would I do here to have the datastore load the saved Values**? while true do wait(60) for i,v in pairs(game.Players:GetPlayers()) do saveStats(v) end end game.Players.PlayerRemoving:connect(saveStats) getStats.OnInvoke = getStats