cancel
Showing results for 
Search instead for 
Did you mean: 

Simple leaderboard don't update value

dello32
Member
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? :'(
1 ACCEPTED SOLUTION

Accepted Solutions

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

Upcoming Events:
AMA - Oh My GenAI! A Practical Toolkit Tour Tuesday, May 6th 11:00 AM PT - Register
Build-Along - Code Smarter, Not Harder with Your AI Assistant Tuesday, May 20th 11:00 AM PT - Register
May Programming Calendar

View solution in original post

4 REPLIES 4

SeeingBlue
Mentor

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

SeeingBlue_0-1745257832950.png

 

Upcoming Events:
AMA - Oh My GenAI! A Practical Toolkit Tour Tuesday, May 6th 11:00 AM PT - Register
Build-Along - Code Smarter, Not Harder with Your AI Assistant Tuesday, May 20th 11:00 AM PT - Register
May Programming Calendar

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.

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

Upcoming Events:
AMA - Oh My GenAI! A Practical Toolkit Tour Tuesday, May 6th 11:00 AM PT - Register
Build-Along - Code Smarter, Not Harder with Your AI Assistant Tuesday, May 20th 11:00 AM PT - Register
May Programming Calendar

can you also invite me - it'd be nice to learn from a working example of this!