How to find a most frequent value in a table

Basically im making a voting system, everything works fine but i cant figure out how to get the most frequent votes

1 Like

– let’s say there’s 2 values
local A = 0
local B = 0
– and now for the votes table
for i,v in pairs(Yourvotestable) do
if v == “A” then
A += 1
elseif v == “B” then
B += 1
end
end

local A = 0
local B = 0

local VotesTable ={}

for i,v in pairs(VotesTable) do
if v == "A" then
A += 1
elseif v == "B" then
B += 1
end
end

something similar to this would work, I’d need to see your script to provide further help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.