local function LoadLeaderboardSave(player) if player.userId <= 0 then return end --error here player:WaitForChild("leaderstats") wait() local leaderboardStats = leaderboardData:GetAsync(player.userId) for i, stat in pairs(leaderboardStats) do local currentStat = player.leaderstats:FindFirstChild(stat[1]) if not currentStat then return end currentStat.Value = stat[2] end Print("Loaded "..player.Name.."'s leaderstat data") end
this is the error
ServerScriptService.Leaderboard:167: attempt to index nil with 'userId'