Skip to main content
dello32
Inspiring
April 21, 2025
Solved

Simple leaderboard don't update value

Hello meta creators,
I need some help because I truly want to cry. Since I deleted the leaderboard in ONE world, it's now impossible for me to get the leaderboard working in any world.
 
Can someone test this script to update a leaderboard?
 
Create a leaderboard in /Systems/leadersboard with the name "test".
 
Create the leaderboard at /Entity Build/Gizmo/WorldLeaderboard, and set its Leaderboard to "test".
 
Create a script object: Scripts/[+]/ and paste the code.
 
Create a Trigger and set its script to execute this code.
 
import * as hz from 'horizon/core';
export class TriggerScoreUpdater extends hz.Component<typeof TriggerScoreUpdater> {
  start() {
    this.connectCodeBlockEvent(this.entity, hz.CodeBlockEvents.OnPlayerEnterTrigger,
      (enteredBy: hz.Player) => {
        console.log(`Player ${enteredBy.name.get()} set leaderboard to 42`);
        this.world.leaderboards.setScoreForPlayer("test", enteredBy, 42, false);
      }
    );
  }
}
hz.Component.register(TriggerScoreUpdater);
 
Does it work for you? What am I doing wrong? :'(
SeeingBlue
Honored Contributor
April 26, 2025

I think there is a setting in your horizon menu that lets you exclude yourself from leaderboards.

Upcoming Events : Performance Pro - UI Unleashed - Building Responsive & Performant Interfaces Thursday June 19th 5:00 PM PT - Register June Programming Calendar

4 replies

SeeingBlue
Honored Contributor
April 21, 2025

Everything appears correct, also worked for me. I invited you as a editor to the world.

 

Upcoming Events : Performance Pro - UI Unleashed - Building Responsive & Performant Interfaces Thursday June 19th 5:00 PM PT - Register June Programming Calendar
dello32
dello32Author
Inspiring
April 26, 2025

Thanks for the test. In facr my profil seems broken, people can update the leaderboard, but not me. I'm in holidays but i will test your world when i can, i suppose that i won't appeare in your leaderboard.

SeeingBlue
Honored Contributor
April 26, 2025

I think there is a setting in your horizon menu that lets you exclude yourself from leaderboards.

Upcoming Events : Performance Pro - UI Unleashed - Building Responsive & Performant Interfaces Thursday June 19th 5:00 PM PT - Register June Programming Calendar