#How to get the highest number from a list of numbers.

1 messages · Page 1 of 1 (latest)

teal turret
#

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.

astral narwhalBOT
#

studio** You are now Level 1! **studio

languid cave
#

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.

teal turret
#

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

queen hull
#

Once you have a table use table.sort

queen hull
#

Then the highest value will be the first object of the table

teal turret
#

so as far as ik table.sort sort sorts the numbers from smallest to highest is that correct?

queen hull
#

It sorts depending on what you return

teal turret
queen hull
#

if you did

return x.Value < y.Value

then it would sort them from least to greatest

teal turret
#

oh that makes sense now