I have my leaderboard properly made. I need it to save using data stores, but my script isn't working.
datastore = game:GetService("DataStoreService"):GetDataStore("Growth")
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
wait(1)
local stats = player:FindFirstChild("leaderstats").Growth.Value
stats = datastore:GetAsync(player.UserId)
end)
for i,v in pairs(game.Players:GetChildren()) do
for x,c in pairs(v:FindFirstChild("leaderstats")) do
for a,b in pairs(c:FindFirstChild("Growth")) do
b.Changed:connect(function()
datastore:SetAsync(v.UserId, b.Value)
end)
end
end
end

2 comments
Please give us a start to what's wrong.
I don't know where the error is.