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
	return chosenMap

local mapWithMostVotes = chooseMap(mapVotes)

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