#ScoreboardIdentity became undefined inside for loop?

1 messages · Page 1 of 1 (latest)

timid tiger
#

move console.warn(Prev[0].displayName)
after
if (Prev.length === 0)

icy cloud
timid tiger
#

after

icy cloud
#

nothing's changed, it still outputing right

timid tiger
#

displayName is not a participants property

#

but that doesn't seem to be the problem anyway

prime kraken
icy cloud
#

so what did i do wrong?

prime kraken
#

no idea

icy cloud
#

fuck

prime kraken
#

is there like

#

any other code context

#

that would be useful

#

i see var is used and sometimes that can have unexpected overlap when it comes to for loops

timid tiger
#

you sure the score have participants?

icy cloud
#

imma use different variable name?

prime kraken
#

you could also just use let

icy cloud
#

okay tried it and but still same error

icy cloud
timid tiger
icy cloud
#

here the first line shows the displayName of the 1st participant

timid tiger
icy cloud
timid tiger
#

do a loop through the Participants and display the displayName to the log

icy cloud
#

what do you mean

prime kraken
timid tiger
#

never used fake player
so i assumed he is right

icy cloud
#

but fake player is not an entity therefore doesn't have an id

timid tiger
#

just try it ...

prime kraken
#

oh didnt realize gametest called them fake players

prime kraken
#

scoreboard players set "some random string" objective 3
(might be out of order but yk what i mean)

#

so doing .id really wont work here

#

but anyways thats not related to the error

prime kraken
icy cloud
#

hmm

that code is inside many blocks

itemUseOn

  • if block to check item id
    • form 1
      • form 2
prime kraken
#

i meant like

#

is there any other code

#

that uses the variable "Prev"

icy cloud
#

i changed it, still receiving same error

prime kraken
#

???

timid tiger
#
const test = world.scoreboard.getObjective("revenues").getParticipants()
test.forEach((p) => {
    const t = {
        id: p.id,
        name: p.displayName,
        id2: evt.source.id
    }
    console.warn(JSON.stringify(t, null, 2));
})

use this and send your content log