Help with global leaderboard

Prints “no” every function, am I missing something?

local function UpdateLeaderboard()
	for i, v in pairs(Players:GetPlayers()) do
		SlaughtersData:SetAsync(v.UserId.."-Slaughters", v.Slaughters.Value)
	end
	local Success, Error = pcall(function()
		local Data = SlaughtersData:GetSortedAsync(false, 5)
		local SlaughtersPage = Data:GetCurrentPage()
		for Rank, SavedData in ipairs(SlaughtersPage) do
			local Slaughters = SavedData.Value
			if Slaughters then
				local UserID = tonumber(SavedData.Key)
				local Username = Players:GetNameFromUserIdAsync(UserID)
				print(Username)
				if UI.PlayerName[Rank].Text ~= Username then
					UI.PlayerName[Rank].Text = Username
					UI.Slaughters[Rank].Text = Slaughters
					if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(UserID, 41158387) then
						UI.OwnsX2[Rank].Text = "Yes"
						UI.OwnsX2[Rank].TextColor3 = Color3.new(0, 1, 0)
					else
						UI.OwnsX2[Rank].Text = "No"
						UI.OwnsX2[Rank].TextColor3 = Color3.new(1, 0, 0)
					end
					UI.Portrait[Rank].Image = Players:GetUserThumbnailAsync(UserID, Enum.ThumbnailType.AvatarBust, Enum.ThumbnailSize.Size180x180)
				end
			else
				print("no")
			end
		end
	end)
end

uncapitalize the v in Value.

local Slaughters = SavedData.value

That solved that although I am still missing something.

UserID prints nil

if Slaughters then
		local UserID = tonumber(SavedData.Key)
		print(UserID)
		local Username = Players:GetNameFromUserIdAsync(UserID)
		print(Username)

I also tried uncapitalizing “Key” but didn’t work too

that’s weird, it should work without the capital for “key”. Try removing the tonumber from it as the key could be a string with a letter and not a number.

Ahhh I see. It worked with SavedData.key