#how do I make a runCommand execute for all entities of this const?

1 messages · Page 1 of 1 (latest)

pulsar meadow
#
    const players = player.dimension.getEntities({location: player.location, families: ["player"], maxDistance: 30})
pulsar meadow
#

Never mind, the hole is much deeper...

#

Because I had to identify this in the "If"

tawny narwhal
#

you can use a for loop

pulsar meadow
#

So I will need to make a bigger code

pulsar meadow
#

And for that, I'll have to do something more complex...

vapid scaffold
#

ooowhh i know how to do that

#
const players = player.dimension.getPlayers({ location: player.location, maxDistance: 30})

if (players.find(f => f.id == player.id).getDynamicProperty() > player.getDynamicProperty())

#

wait a minute:v thats just the same

pearl tulip
#

ehmm use a forEach?

#
players.forEach(player => {
    player.runCommand('say a')
})```
clear osprey
#

and then

players.forEach(p => {
    p.sendMessage('yeet');
});