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

How can I organize players by their scores?

Asked by
Zerio920 285 Moderation Voter
7 years ago

I'm working on a round-based game. Players earn points, and after the round is over each player is given a place (first place, second place, third place, etc.) based on how many points they've earned. However, I am unsure of the best way to organize the players by how many points they've earned to figure out what place each player gets. Any help would be appreciated.

1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

This is a common programming question and there are multiple solutions.

Bubble sort this is one of the more inefficient ways but it is simple to code. You loop until no changes have been made to the list, swapping the values place each time.

Insertion_sort

Selection_sort

These are the sorting algorithms covered by Roblox and there are a lot more.

I would recommend you use Insertion sort as it is one of the more efficient algorithms .

Hope this helps.

0
Thanks! I'll check it out. Zerio920 285 — 7y
Ad

Answer this question