#How to resolve: intializer error
1 messages · Page 1 of 1 (latest)
jsfor (const player of world.getAllPlayer().hasTag("sts") {
if(player.hasTag("saude1")) {
player.runCommandAsync("effect @s health_boost 1 2");
}
}
try this
Thats dont works
system.runInterval(() => {
for (const player of world.getPlayers({tags:['sts']})) {
if (player.hasTag("saude1")) {
player.runCommandAsync("effect @s health_boost 1 2");
}
}
})
Now its given thats error:
In that line: for (const player of world.getAllPlayers({tags:["sts"]})) {
Bro the answer code he gave u is getPlayers not getAllPlayers
getAllPlayers doesnt accept arguments, just getAllPlayers() like plain @a
Why do you check for the presence of one tag when receiving a list of players and another tag is checked using "if"
oh yes, that makes sense, thanks
How to resolve: intializer error
@dense void why
?
asking the poster
It's because it's a status system, first it checks if the player has already opened the status menu with the "sts" tag, and then it checks the health level, checking which tag the player has, if it is "saude1" so the health level is 1, and it applies the healt boost effect.