Top 10 of a scoreboard objective

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Deacon

Member
Apr 17, 2017
12
0
1
33
Hi there, is there any way to show the top 10 players with the highest "wins"scoreboard objective on the sidebar.

Example of the sidebar:

TOP 10 PLAYERS
Player1 100
Player2 90
Player3 75
Player4 60
Player5 50
Player4 40
Player3 30
Player2 20
Player1 10
 
Hi there, is there any way to show the top 10 players with the highest "wins"scoreboard objective on the sidebar.

Example of the sidebar:

TOP 10 PLAYERS
Player1 100
Player2 90
Player3 75
Player4 60
Player5 50
Player4 40
Player3 30
Player2 20
Player1 10
Try using:
code_language.skript:
#your scoreboard event
    loop {YourVariable::*}:
            add 1 to {_size}
            if {_low.to.high.list::%loop-value%} is not set:
                set {_low.to.high.list::%loop-value%} to loop-index
            else:
                set {_n} to 0
                loop {_size} times:
                    set {_n} to {_n}+1
                    {_low.to.high.list::%loop-value-1%.%{_n}%} is not set:
                        set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
                        stop loop
        wait 1 tick
        set {_n} to size of {_low.to.high.list::*}
        loop {_low.to.high.list::*}:
            set {_high.to.low.list::%{_n}%} to loop-value
            set {_n} to {_n}-1
        wait 1 tick
        set {_i} to 0
           
        set score "Top 10 players " in sideboard of player to 15
        loop {_high.to.low.list::*}:
            add 1 to {_int}
            set {_player} to "%loop-value%" parsed as offlineplayer
            set score "%{_int}% %{_player}% %{YourVariable::%loop-value%}%" in sidebar of player to {_int}
            if {_int} > 9:
                stop loop
        set score "The rest..." in sidebar of player to 4
        #...
 
Status
Not open for further replies.