Leaderboard Hologram (Not Infinite)

Some notes before we get inside the explanation:

  1. The coding format of the leaderboard hologram is much more different and intricate than the leaderboard scoreboard. Mainly because of how the scoreboard worked.
  2. There are different ways to code this other than my method such as BallPen’s, Hxncus’s, McMaster’s, etc… but they both had the same issues and just technically used the same format and made some changes to the source code. Mine is pretty different and distinct from others, it is also the most accurate and relatable method for now as well.
  3. For people who don’t understand why the name of the thread contained “not infinite” is because a few days ago I and McMaster were working on a way to make a self-generate position leaderboard (using hologram and scoreboard). It basically generates and assigns positions 1, 2, 3, etc… to each individual that had at least logged in the world once. In brief, I put it inside the name to prevent misapprehension and confusion, and thinking infinite and not infinite are the same thing.
  4. I recommend checking out AtomSeis’s tutorial about dynamic variables and variable API tags first for a better understanding of this code by clicking here.
    Now after you had finished reading all the notes let’s hop on the explanation.

Format of it:
If not inverse proportion:

» Top 1:
Function (a) {
If variable compare number Top 1 value variable < (x)
If variable %player% or %selected% != Top 1 name
Set variable Top 1 back up value variable = Top 1 value variable
Set variable Top 1 back up name variable = Top 1 name variable
Set variable Top 1 value variable = (x) variable
Set variable Top 1 name variable = Game value[“Current name of player”]
Set variable Top 2 value variable = Top 1 back up value variable
Set variable Top 2 name variable = Top 1 back up name variable
Else
Set variable Top 1 value variable = (x) variable
Set variable Top 1 name variable = Game value[“Current name of player”]
}

» Top 2, Top 3, … Top n:
Function(a(n)) {
If variable compare number Top n value variable < (x) < Top n-1 value variable
If variable %player% or %selected% != Top n name
Set variable Top n back up value variable = Top n value variable
Set variable Top n back up name variable = Top n name variable
Set variable Top n value variable = (x) variable
Set variable Top n name variable = Game value[“Current name of player”]
Set variable Top n+1 value variable = Top n back up value variable
Set variable Top n+1 name variable = Top n back up name variable
Else
Set variable Top n value variable = (x) variable
Set variable Top n name variable = Game value[“Current name of player”]
}

If inverse proportion:

» Top 1:
Function(a) {
If variable compare number Top 1 value variable > x
If variable %player% or %selected% != Top 1 name
Set variable Top 1 back up value variable = Top 1 value variable
Set variable Top 1 back up name variable = Top 1 name variable
Set variable Top 1 value variable = (x) variable
Set variable Top 1 name variable = Game value[“Current name of player”]
Set variable Top 2 value variable = Top 1 back up value variable
Set variable Top 2 name variable = Top 1 back up name variable
Else
Set variable Top 1 value variable = (x) variable
Set variable Top 1 name variable = Game value[“Current name of player”]
}

» Top 2, Top 3, … Top n:
Function(a(n)) {
If variable compare number Top n value variable > (x) > Top n-1 value variable
If variable %player% or %selected% != Top n name
Set variable Top n back up value variable = Top n value variable
Set variable Top n back up name variable = Top n name variable
Set variable Top n value variable = (x) variable
Set variable Top n name variable = Game value[“Current name of player”]
Set variable Top n+1 value variable = Top n back up value variable
Set variable Top n+1 name variable = Top n back up name variable
Else
Set variable Top n value variable = (x) variable
Set variable Top n name variable = Game value[“Current name of player”]
}

If you are trying to make like Top n ← Top 1 (n > 1) instead of Top n → Top 1 then simply change the variables’ names. I will be explaining with Top n → Top 1 instead for an easier understanding.

Priorities:
This is the most important step and also the step where a lot of coders failed to find the problem within their code. It basically controls which top (n) will be triggered first. For instance:

Top n >> Top n-1 >> Top 1 (a)
II (or)
Top 1 >> Top n-1 >> Top n (b)

The format I said above only works if the first priority method (a) is utilized. The reason is the top n-1 and top n will get overwritten by either top 1 or top n-1 if you try to use the second priority method (b).

Explanation:
Now I will explain how this code even works in the first place. Basically, I have an operation like this:

Player event left click
Set variable %player%click += 1

So every time the player left clicks it will trigger the player event left click operation and it gonna increase their %player%click’s value by 1 using set variable +=.
Next, I will have a function called (a). By utilizing the “Top 2, Top 3, … Top n” method I said above we will have a code that looks like this:

Function(a) {
If variable compare number Top 3 value variable < %player%click < Top 2 value variable
If variable %player% or %selected% != Top 3 name
Set variable Top 3 back up value variable = Top 3 value variable
Set variable Top 3 back up name variable = Top 3 name variable
Set variable Top 3 value variable = %player%click variable
Set variable Top 3 name variable = Game value[“Current name of player”]
Set variable Top 4 value variable = Top 3 back up value variable
Set variable Top 4 name variable = Top 3 back up name variable
Else
Set variable Top 3 value variable = %player%click variable
Set variable Top 3 name variable = Game value[“Current name of player”]
}
4 = n + 1
3 = n
2 = n - 1

Function named “a” will check whether if the %player%click’s value is greater than the current Top 3 variable’s value and smaller than Top 2 variable’s value (Top 3 value variable < %player%click < Top 2 value variable). Then it checks whether your name is != Top 3 name (If variable %player% or %selected% != Top 3 name) to prevents from value overwrite on both top 3 and top n+1(4). After that, it assigns 2 variables with the name “Top 3 value variable” and “Top 3 name variable” to 2 back up variables named “Top 3 back up value variable” and “Top 3 back up name variable” respectively. These 2 variables are used to prevent the top n’s value and name overwrite the top n-1’s value and name. Example:

Top 3 value variable = “10”
Top 3 name variable = “deefer”
Top 2 value variable = “15”
Top 2 name variable = “beefer”

If we increase the Top 3 value variable by 6 then the Top n value variable > Top n-1 value variable by 1. Now we gonna try assigning the Top 3 variable to the Top 2 variable and the Top 2 variable back to the Top 3 variable without using the Top 2 backup value and name variables then it gonna look like this:

Top 3 value variable = “16”
Top 3 name variable = “deefer”
Top 2 value variable = "16"
Top 2 name variable = "deefer"

If we use backup value and name variables then it gonna show like this:

Top 3 value variable = "15"
Top 3 name variable = "beefer"
Top 2 value variable = "16"
Top 2 name variable = "deefer"

If you still did not understand then let me put the backup name and value variables for a thorough explanation:

Top 3 value variable = “10”
Top 3 name variable = “deefer”
Top 2 value variable = “15”
Top 2 name variable = “beefer”

Save the Top 2 value variable and Top 2 name variable within the Top 2 backup value variable and Top 2 backup name variable:

Top 2 backup value variable = “15”
Top 2 backup name variable = “beefer”

Now increase the Top 3 variable’s value by 6 we will have 16

Top 2 value variable = “16”
Top 2 name variable = “deefer”

Assigning the Top 2 backup value and name variables to the Top 3 value and name variables we will have:

Top 3 value variable = "15"
Top 3 name variable = "beefer"
Top 2 value variable = "16"
Top 2 name variable = "deefer"

Now after you understand how the assignment works. It is time to explain how the else part works:

Else
Set variable Top 3 value variable = %player%click variable
Set variable Top 3 name variable = Game value[“Current name of player”]

Else basically changed a statement from true to false and vice versa. Example:

If variable != >> else >> If variable =

What else does here is basically prevent the top n’s variables from consecutively assigning back to the top n+1’s variables every time the %player%click’s value got changed. So the values of both of them don’t match each other.

Other methods:

  1. Arrays
  2. Same as this method but instead of else we can use loops
  3. Entities (not recommend)

Summarise:
Leaderboard hologram is regarded as one of the most lengthy, complicated, and difficult codes out there. Challenges best coders namely BallPen, McMaster, TheSuperiorXMod9, etc… Yet the solution to fix it is very simple, 2 backup variables to prevent top n and top n+1 overwriting each other. I hope this helped despite I have seen lots of players start asking how to code this code from seeing it inside nasok and egor’s world.

2 Likes

so where to put the text like it will say

I. - Hey - 100
II. - Hello - 69
III - Hi - 40
? i have coded the format but dont know where to put the text and create hologram code

Just use the combine text and combine the top_1_name and top_1_requirement together into a variable. Put that variable inside the create hologram.

hologram lb - YouTube idk whats the problem it doesnt work can u please check

You need to make the top 5 top 4 top 3 first as I said above instead of putting the top 1 at the start of the chain.

Screenshot (1320)
whats wrong wth

Did you delete the variable or set all the variables back to 0?

yes
i delete all variables

Can you send me a screenshot of the code?

image

i put top 3 at first of chain

top 3 → top 2 → top 1?

yes top 3 > 2 > 1 dsadsads

Ok cool now I am afraid because of the else placement. You can try use loop instead and follow the code like this:

Loop (5 ticks) → Select object player condition name equals (top_3_name) → Set variable = (top_3_requirement = %selected%[variable_name]) → So on with top 2 and top 1 ] ]

Destroy the else and use the loop above.

1 Like

different loops for each top n?

No, just put it next to the select object and in the same line.

1 Like

Ok now top2 and 3 doesnt even show now
image

Ya try donate again because I didn’t use loop to update the hologram so you needed to manually update it yourself by triggering action.

i did on both acc
it just takes over the previous top 1 doesnt show top 2 and 3

Try use loop then, if doesn’t work then your code is wrong at some part because the format I said above is accurate.

can i show u like a video or sumthing of the code