What do you want to achieve? Keep it simple and clear!
I wan’t to achieve a system where people with most points wins and the others gets cash depending your place
What is the issue? Include screenshots / videos if possible!
I don’t know how to use the table.sort() because i just started
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to see the lua page and developer hub but i didn’t understand, or sometimes they didn’t explained at all.
There’s a variable called _G.PlayersEscaped if that’s useful for you. If you need more information i can say it.
table.sort is meant to sort an array from the first to last element in ascending order (least to greatest). It has one required parameter which the table you need to sort and an optional one which is the comparison function to use. If you don’t provide a function, it will use the default comparison, <.
The comparison function will be called with two parameters. The function needs to return a boolean, so that’s true or false. The boolean is meant to determine if the first argument should come first in the sorted table. If it’s false, then obviously that won’t be the case.
Take this for example:
local a = {2, 1}
print(a[1] < a[2]) -- false
We have a table with the first element as 2 and the second as 1. We run the default comparison, <, on both these elements. This comparison returns false because 1 is not greater than 2. Because it is false, 2 should not come first in the sorted array.