#why dosent the objective display
1 messages · Page 1 of 1 (latest)
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
how do i display score on a form?
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;
}
}
like rawtext
alr
same as title n stuff
seperate file correct?
its easier that way
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);
}
})
} ```
ik its form
this ${getScore(player, money)}
thats the fixed code?
rawtext works in forms on this update
this code is missing several things if you want it to work well
form.body({rawtext:[{text:`§c§l» §l§6Need to buy something ?\nYour money : §r§f`},{score:{name:'*',objective:'money'}}]})
oh well
thats the addon
use ur getScore for now ig
you could look at it there maybe i did something wrong
???
i dont even know what that is
also i ues it