const getScore = (objective, target, useZero = true) => {
try {
const obj = world.scoreboard.getObjective(objective);
if (typeof target === 'string') {
return obj.getScore(obj.getParticipants().find(v => v.displayName === target));
}
return obj.getScore(target.scoreboard);
} catch {
return useZero ? 0: NaN;
}
}
#Why it doesn't work?
1 messages · Page 1 of 1 (latest)
Please help
what error do you get @visual comet
Even if the value on the scoreboard is lower than the itemPrice, the purchase still proceeds
if (playerMoney < itemPrice) here playerMoney is a string : const playerMoney = "money"; could it be the problem ?
Idk
well you are comparing a string to a number so
Debug Result
There is an error in this [code](#1239468418491482273 message):
[36m<repl>.js[0m:[33m3[0m:[33m26[0m - [31merror[0m[30m TS2304: [0mCannot find name 'ChestFormData'.
[7m3[0m const mainMenu = new ChestFormData('27')
[7m [0m [31m ~~~~~~~~~~~~~[0m