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'

2 comments

0

provide us with more information about the script, the error at line 167

0

show the part where you use LoadLeaderboardSave() i think the player param is wrong