why doesnt my setscore add parameter work
const setScore = (objective, target, amount, add = false) => {
try {
const scoreObj = world.scoreboard.getObjective(objective);
const score = (add ? target.scoreboardIdentity?.getScore(scoreObj) : 0) + amount;
if (typeof target === 'string')
scoreObj.getParticipants().find(v => v.displayName == target)?.setScore(scoreObj, score);
else target.scoreboardIdentity.setScore(scoreObj, score);
return score;
} catch { return NaN };
}```
