I have a map voting system everything works but 1 thing. how can i make a system that when an event is run it calculates the most voted map out of 4 number values in replicated storage and it stores the index of the winning msp in another number value also located in replicated storage for example say the first map won the index would be 1 also there are 4 maps to vote for and i cant get it to work no matter how hard i try ik it should be easy but for sm reason it just wont work.
#How to get the highest number from a list of numbers.
1 messages · Page 1 of 1 (latest)
** You are now Level 1! **
You seriously need to change the approach. Nobody builds a map vote system this way
Try a server script that stores the map votes in a table
If you don't get how. You needa try building simpler systems first like a points UI and a shop UI
That'll help you learn more about handling Clicks, storing values and flags, etc.
thats what confuses me i have a table and i hqve the button clicks add up the votes it works well but still i csnt get the system to calvulate the most voted map
Once you have a table use table.sort
I'm assuming you have a folder holding the integer values and using GetChildren() for the table?
If so:
table.sort(yourTable, function(x, y)
return x.Value > y.Value
end)
Then the highest value will be the first object of the table
so as far as ik table.sort sort sorts the numbers from smallest to highest is that correct?
It sorts depending on what you return
ok ill try it out later thx
if you did
return x.Value < y.Value
then it would sort them from least to greatest
oh that makes sense now