ive looked at many other topics but none worked for me
im trying to get the highest number from 3 number values, and then figure out which value the highest number value belongs to.
i also need a way to get a random winner when it ties
1 Like
Assign which button the map will pick by its name. Create a table to store the votes, in shwich you assign the map name as an index with a table in it. And when a player comes to vote for the map, store them into the table, you can thencound the number of votes by saying #table
and then finding which has the highest value by iterating through them.
local highest = 0 -- start at zero, but look for a higher number
local currentMap = "" -- map chosen
for name, data in votes do -- iterate through all of them
if #data > highest then -- check if the number of entries is higher
highest = #data; -- apply new data
currentMap = name
end
end
print(currentMap, highest) -- whatever map
ended up finding out how to do it myself, thanks for helping though!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.