Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I get highest number without comparison operators?

I'm trying to make a leaderstats where it saves some number, I'm trying to get the highest number in the server without using comparison operators. How do I do so?

1 comment

0

pls help :smiling_face_with_tear: :pensive:

1 answer

✓ Accepted answer

You can save all the numbers in a table and then use table.sort. Table.sort is a function that can sort elements of array t in a given order, from t[1] to t[#t]; for example:

table.sort(yourTable, function(a,b) return a > b end)

For more information, you should check: https://developer.roblox.com/en-us/api-reference/lua-docs/table

2 comments

0

so the value at the top is highest?

0

It sorts from low to high, however if you want it to sort from high to low you should change the ">" to a "<"

This discussion is preserved as it was. New answers, comments, and votes are closed.