# How to get rid of possible ties?

So for context, the players vote for one of three maps. The issue is I have no way of getting the most voted map while breaking up ties.

For instance, sometimes Map1 has 3 votes, Map2 has 1 vote and Map3 also has 3 votes. This is the script I have so far.

``````for i,v in pairs(VotingOptions) do
end
end
end
``````

What it does is it iterates through the votes and breaks up ties. I also don’t know how to get the most voted one of them all. Also will it even break up all ties?

Any help is appreciated.

Also, you clearly do not understand some basics. It’s best to understand atleast the basics before going into making a game. Scripting Basics - Beginner guide to lua and Roblox

Where did he said math.random? He does understands some basics, like for loops, and if statements. You can just compare the 3 values together, determine what is the tie, and get rid of it.

1 Like
``````local Votes = {
{
["Name"] = "A"
},
{
["Name"] = "B"
},
{
["Name"] = "C"
},
}

local Highest = {}
for i, v in pairs(Votes) do
if Highest[1] == nil then Highest[1] = v continue end
Highest[1] = v
continue
Highest[2] = v
continue
end
end
if Highest[2] == nil then
Highest = Highest[1]
else
``````table.sort(VotingOptions, function(a, b) return a.Votes > b.Votes end)  -- Sort by votes