How to connect the map with the most amount of votes to teleporting the players there?

As title says, i’ve looked for a while and couldnt really find anything to help. Im quite new to scripting and im clueless on how to connect the most voted map to teleporting the players there. Any help?

local mapVotes = {
	["map1"] = 5;
	["map2"] = 10;
	["map3"] = 2;
	["map4"] = 11;
}

local function chooseMap(votes)
	local chosenMap = nil
	local highestVote = -1
	
	for mapName, voteNum in pairs(votes) do
		if (voteNum <= highestVote) then continue end
		highestVote = voteNum
		chosenMap = mapName
	end
	
	return chosenMap
end

local mapWithMostVotes = chooseMap(mapVotes)
print(mapWithMostVotes)

You can use this method (chooseMap function) to find out highest or lowest value efficiently.