One out of the 2 stats on my leader board are not saving and I have tried for the last hour to fix it but I hade no luck so maybe someone here can help :)
PointData = game:GetService("DataStoreService"):GetDataStore("PointData") Bought = game:GetService("DataStoreService"):GetDataStore("Bought")
game.Players.PlayerAdded:Connect(function(plr) local LB = Instance.new("IntValue") LB.Name = "leaderstats"
local p = Instance.new("IntValue")
p.Name = "Points"
p.Value = PointData:GetAsync(plr.userId) or 0
local r = Instance.new("IntValue")
r.Name = "Bought"
r.Value = Bought:GetAsync(plr.userId) or 0
LB.Parent = plr
p.Parent = LB
r.Parent = LB
end)
game.Players.PlayerRemoving:Connect(function(plr) PointData:SetAsync(plr.userId, plr.leaderstats.Points.Value) Bought:SetAsync(plr.userId, plr.leaderstats.Bought.Value) end)
It dose not save the bought stat I use the bought to keep track of what they bought and so everyone else can see how much stuff they bought but it dosent save.

3 comments
Fix your formatting please the whole script should be invaded in ————————
https://forum.scriptinghelpers.org/topic/82/how-to-format-questions-answers-on-the-main-site
I like fixing datastores but i hate improper formatting.