#Error: Failed to resolve identity for 'PinhoPlays' at <anonymous>

1 messages · Page 1 of 1 (latest)

floral rivet
#

const ovw = world.getDimension('overworld')

system.runInterval(() => {
  for (const entity of ovw.getPlayers()) {
    var familia = world.scoreboard.getObjective("family").getScore(entity)
}})

Not all players have this score, so this error occurs. How do I avoid this error when the player doesn't have the score?

floral rivet
#

hello! help me?

lapis summit
#

what is ovw

#

shouldnt it be world

silk quiver
#
system.runInterval(() => {
  for (const entity of ovw.getPlayers()) {

    const familiaObjective = world.scoreboard.getObjective("family") ?? world.scoreboard.addObjective("family", "familyObj");

    const familiaScore = familiaObjective.getScore(entity) ?? familiaObjective.setScore(entity, 0);

    }
});

Maybe like that?

#

wait, it seems wrong

lapis summit
#

oh i see the problem

silk quiver
floral rivet
silk quiver
#

ye

lapis summit
#

@floral rivet

const ovw = world.getDimension('overworld')

system.runInterval(() => {
  for (const entity of ovw.getPlayers()) {
    const familia = world.scoreboard.getObjective("family").getScore(entity);
 }}
)
#

i think you were just missing a )

silk quiver
#

but nvm, if this fixes it thats great

lapis summit
#

you did

  }
})
floral rivet
lapis summit
#

you were missing a )

#

and var didnt make sense

#

so i changed the variable declaration to const anyway

silk quiver
#

ye

silk quiver
lapis summit
#

that one you sent and deleted wasnt

floral rivet
#

@lapis summit It was just a typo when sending this post, the problem still occurs

silk quiver
floral rivet
#

players who have no score make the mistake run

silk quiver
mint lantern
lapis summit
#

i assumed you had already added the score

#

if you just have an objective added and no score, it wont work

silk quiver
floral rivet
#

but I want some players to not have the score

lapis summit
silk quiver
floral rivet
silk quiver
#

🕊️

silk quiver
#

but I still think it might not work

mint lantern
#

like fix_score to 0 or something