#can anybody help w this getscore

1 messages · Page 1 of 1 (latest)

honest crown
#
export function Boosts(player) {
    try {
        const boostsMenu = new ActionFormData()
            .title('§l§3- EXP BOOST MENU -§r')
            .body(`You can activate boosts by clicking the buttons bellow\nYou have ${getScore(`expboosts15`)} 1.5X EXP BOOSTS\nYou have ${getScore(`expboosts20`)} 2X EXP BOOSTS`)
            .button(`§l§2 ACTIVATE 1.5X XP BOOST`)
            .button(`§l§4 ACTIVATE 2X XP BOOST`) //closing menu doesnt need a result and will just close as it has no after function.
        boostsMenu.show(player).then((response) => {
            switch (response.selection) {
                case 0:
                    player.runCommandAsync(`tellraw @s {"rawtext":[{"text":"[§c!§f]working!"}]}`)
                    break;
            }
        });
    } catch (error) {
        console.warn(error)
    }
}```
Works in the actionform but it does not show the score the player actually has it shows 0 boosts constantly
languid sedge
#

well wheres ur get score

#

also a getScore function should consist of the target and the objective

honest crown
#
export function getScore(target, objective) {
    try {
        return world.scoreboard.getObjective(objective).getScore(typeof target === 'string' ? oB.getParticipants().find(pT => pT.displayName == target) : target.scoreboard)
    } catch {
        return 0
    }
}```
languid sedge
#

getScore(player, "objective")

honest crown
#

ohh right thanks

languid sedge
#

i think its also

#

scoreboardIdentity

#

target.scoreboardIdentity