Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get highest number without comparison operators?

Asked by 2 years ago
Edited 2 years ago

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?

0
pls help :smiling_face_with_tear: :pensive: WINDOWS10XPRO 438 — 2y

1 answer

Log in to vote
1
Answered by 2 years ago

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

0
so the value at the top is highest? WINDOWS10XPRO 438 — 2y
0
It sorts from low to high, however if you want it to sort from high to low you should change the ">" to a "<" davidladmuta 71 — 2y
Ad

Answer this question