1_x409 Posted June 4, 2023 Share Posted June 4, 2023 So I need a leaderboard for a variable called {toproll::%uuid of player%}. The numbers in it are like "83.23832638". Please help Link to comment Share on other sites More sharing options...
JoshG Posted June 4, 2023 Share Posted June 4, 2023 Hey hey! Maybe something a little like this? command /leaderboard: permission: leaderboard.access trigger: set {_sortedEntries} to a new list loop all players: add player loop-player to {_sortedEntries} with value of {toproll::%uuid of loop-player%} sort {_sortedEntries} by value from highest to lowest send "&e===== Leaderboard =====" to player loop {_sortedEntries} as {_entry}: send "&6%{_entry}%: %{_entry}%%" to player Let me know if this works! If I helped you at all please consider boosting my account with the follow button! Minehut ♥ [VIP] 12/19/2020 - Present I am either extremely active or not lol.  Link to comment Share on other sites More sharing options...
1_x409 Posted June 4, 2023 Author Share Posted June 4, 2023 I need a hologram, not a command. Thanks though! Â Link to comment Share on other sites More sharing options...
1_x409 Posted June 4, 2023 Author Share Posted June 4, 2023 Is there a required plugin? Â Link to comment Share on other sites More sharing options...
JoshG Posted June 5, 2023 Share Posted June 5, 2023 Sorry, i'm mistaken. To create a leaderboard with holograms for a variable called {toproll::%uuid of player%} in Skript, you can use the following code:  command /leaderboard: trigger: create hologram at location 0, 100, 0: format line 1 with "&6&lTop Rolls" set line 2 of hologram to "&7-----------------" loop all players: set {_player} to loop-player set {_roll} to {toproll::%{_player}%} if {_roll} is set: add {_player} to {_sorted_players::*} add {_roll} to {_sorted_rolls::*} sort {_sorted_rolls::*} in reverse order loop {_sorted_rolls} as {_roll}: set {_player} to {_sorted_players::%loop-value%} set {_formatted_roll} to format number {_roll} rounded to 2 decimal places set line 3 of hologram to "&e%{_formatted_roll}% - %{_player}%'s Roll" remove {_player} from {_sorted_players::*} remove {_roll} from {_sorted_rolls::*} delete {_formatted_roll} This code creates a command called /leaderboard that will update the hologram to display the leaderboard. The hologram is created at coordinates (0, 100, 0) but you can modify these coordinates to suit your needs. To use this code, you need to have the Skript plugin installed on your server. Make sure to copy the code into a Skript file, such as leaderboard.sk, and place it in the Skript plugin's script folder. After that, you can reload or restart your server, and the /leaderboard command should be available for use. When you execute the /leaderboard command, the hologram will update with the top rolls, displaying the roll value rounded to 2 decimal places and the player's name. Please note that this code assumes you have already stored the roll values in the {toproll::%uuid of player%} variable for each player. You will need to update that variable in your Skript code or plugin logic accordingly. If I helped you at all please consider boosting my account with the follow button! Minehut ♥ [VIP] 12/19/2020 - Present I am either extremely active or not lol.  Link to comment Share on other sites More sharing options...
1_x409 Posted June 5, 2023 Author Share Posted June 5, 2023 Alright, I will try it out. Thanks! Â Link to comment Share on other sites More sharing options...
1_x409 Posted June 5, 2023 Author Share Posted June 5, 2023 It did not work, there was an error on line 17. Link to comment Share on other sites More sharing options...
JoshG Posted June 5, 2023 Share Posted June 5, 2023 (edited) My apologies, I think I might have redefined the variable and tried to use it when it wasn't the first definition. I added a player cache in this one, let me know how it goes!  command /leaderboard: trigger: create hologram at location 0, 100, 0: format line 1 with "&6&lTop Rolls" set line 2 of hologram to "&7-----------------" loop all players: set {_player} to loop-player set {_playerCache} to loop-player set {_roll} to {toproll::%{_player}%} if {_roll} is set: add {_player} to {_sorted_players::*} add {_roll} to {_sorted_rolls::*} sort {_sorted_rolls::*} in reverse order loop {_sorted_rolls} as {_roll}: set {_player} to {_sorted_players::%loop-value%} set {_formatted_roll} to format number {_roll} rounded to 2 decimal places set line 3 of hologram to "&e%{_formatted_roll}% - %{_player}%'s Roll" remove {_playerCache} from {_sorted_players::*} remove {_roll} from {_sorted_rolls::*} delete {_formatted_roll} clear {_playerCache}  Edited June 5, 2023 by JoshG If I helped you at all please consider boosting my account with the follow button! Minehut ♥ [VIP] 12/19/2020 - Present I am either extremely active or not lol.  Link to comment Share on other sites More sharing options...
1_x409 Posted June 5, 2023 Author Share Posted June 5, 2023 No, Its the create hologram at location 0, 100, 0: Â Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now