#why dosent the objective display

1 messages · Page 1 of 1 (latest)

pallid crystal
#

towards the bottom of the script there is the main shop form where it is supposed to display your money in the form body but when i use the pack in MC it just displays NaN no matter my money ammount

#

@here please help

pallid crystal
#

how do i display score on a form?

fringe sail
#

hey

#

@pallid crystal

#
export function getScore(player, objective) {
  const { scoreboardIdentity } = player
  if (!(player instanceof Player)) return;
  try {
    return world.scoreboard.getObjective(objective).getScore(scoreboardIdentity)
  } catch (e) {
    return 0;
  }
}
safe prism
pallid crystal
#

alr

safe prism
#

same as title n stuff

pallid crystal
#

its a ui form not a sidebar

safe prism
#

its easier that way

fringe sail
#
    const form = new ActionFormData()
    form.title("§l§6 SHOP UI ")
    form.body(`§c§l»  §l§6Need to buy something ?\nYour money : §r§f${getScore(player, `money`)}`)
    form.button('§l§6» BLOCKS', 'textures/ui/icon_recipe_construction')
    form.button('§l§6» BLOCKS COLORED', 'textures/ui/icon_summer')
    form.button('§l§6» LOG', 'textures/blocks/log_oak.png')
    form.button('§l§6» FURNITURES', 'textures/ui/icon_crafting')
    form.button('§l§6» GLASS', 'textures/blocks/glass_lime')
    form.button('§l§6» TOOLS', 'textures/ui/icon_recipe_equipment')
    form.button('§l§6» ARMORS', 'textures/ui/icon_armor')
    form.button('§l§6» FARMING', 'textures/ui/icon_new')
    form.button('§l§6» FOOD', 'textures/ui/icon_cake')
    form.button('§l§6» ORES', 'textures/ui/icon_best3')
    form.button('§l§6» SPAWNERS', 'textures/blocks/mob_spawner.png')
    form.button('§l§4» EXIT', 'textures/ui/cancel.png')
    form.show(player).then(result => {
      if (result.selection === 0) {
        Block(player);
      }
      if (result.selection === 1) {
        BlockColor(player);
      }
      if (result.selection === 2) {
        Log(player);
      }
      if (result.selection === 3) {
        Furniture(player);
      }
      if (result.selection === 4) {
        Glass(player);
      }
      if (result.selection === 5) {
        Tools(player);
      }
      if (result.selection === 6) {
        Armor(player);
      }
      if (result.selection === 7) {
        Farm(player);
      }
      if (result.selection === 8) {
        Food(player);
      }
      if (result.selection === 9) {
        Ores(player);
      }
      if (result.selection === 10) {
        Spawner(player);
      }
    })
  } ```
safe prism
#

ik its form

fringe sail
#

this ${getScore(player, money)}

pallid crystal
#

thats the fixed code?

safe prism
#

rawtext works in forms on this update

fringe sail
pallid crystal
#

it works well in game

#

although

#

it still says NaN i used the code you sent

safe prism
#
form.body({rawtext:[{text:`§c§l»  §l§6Need to buy something ?\nYour money : §r§f`},{score:{name:'*',objective:'money'}}]})
pallid crystal
#

did what u send still dose not display score

safe prism
#

oh well

pallid crystal
#

thats the addon

safe prism
#

use ur getScore for now ig

pallid crystal
#

you could look at it there maybe i did something wrong

pallid crystal
#

i dont even know what that is

#

also i ues it