#How to resolve: intializer error

1 messages · Page 1 of 1 (latest)

dense void
#

I wrote this code:

  if(saude.hasTag("saude1")) {
    saude.runCommandAsync("effect @s health_boost 1 2");
   }
  }```
When I put it in the world, it gave the error that are missing an intializer for the const variable was missing. how can I solve it?
worthy token
#
jsfor (const player of world.getAllPlayer().hasTag("sts") {
  if(player.hasTag("saude1")) {
    player.runCommandAsync("effect @s health_boost 1 2");
   }
  }
#

try this

dense void
#

Thats dont works

versed crystal
#
system.runInterval(() => {
    for (const player of world.getPlayers({tags:['sts']})) {
  if (player.hasTag("saude1")) {
    player.runCommandAsync("effect @s health_boost 1 2");
   }
  }
}) 
dense void
#

Now its given thats error:

#

In that line: for (const player of world.getAllPlayers({tags:["sts"]})) {

obsidian lily
versed crystal
#

getAllPlayers doesnt accept arguments, just getAllPlayers() like plain @a

echo gulch
dense void
#

How to resolve: intializer error

echo gulch
versed crystal
#

asking the poster

dense void