Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help my leader board is not saveing some of the stats:(. Can someone help?

Asked by 5 years ago

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.

0
Fix your formatting please the whole script should be invaded in ———————— Ziffixture 6913 — 5y
0
I like fixing datastores but i hate improper formatting. DinozCreates 1070 — 5y

Answer this question