dello32
8 months agoMember
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? :'(
I think there is a setting in your horizon menu that lets you exclude yourself from leaderboards.