I have a leaderboard script, and I have a leaderboard for Cash, but when I play the game, it does not show Wins and Cash it just shows Cash.
Script:
for _, player in pairs(game.Players:GetPlayers()) do local stat = player.leaderstats.Wins --When the error appears WinsLB:SetAsync(player.UserId, stat.Value) end for _, frame in pairs(leaderboard.SurfaceGui.Holder:GetChildren()) do if frame:IsA("Frame") then frame:Destroy() end end updateLeaderboards() wait(10)
if you're constantly going to loop through the players and get their "Wins" its best if you wait for it or pass them and come back the next time. Theres a chance that a new player joined while you're looping and the stats have not been created yet.
for _, player in pairs(game.Players:GetPlayers()) do local stat = player:WaitForChild("leaderstats"):WaitForChild("Wins") WinsLB:SetAsync(player.UserId, stat.Value) end