#what is bad in my code i don't understand

1 messages · Page 1 of 1 (latest)

thick schooner
#

There's no world.players

#

And world.addObjectives and world.setObjective

#

Also, wrap inside system.runTimeout

dusk pawn
#

It seems you didn't read the official documentation.

thick schooner
#
import { world, system } from "@minecraft/server"

system.runTimeout(() => {
  const score = world.scoreboard
  const obj =  score.addObjective("Hola", "Hola") 
  score.setObjectiveAtDisplaySlot("sidebar", { objective: obj })

  world.getAllPlayers().forEach(player => {
    player.scoreboard.setScore(obj, 0)
  })
})

//...
dusk pawn
thick schooner
#

I don't think so

#

But I'm just trying to be safe so I don't get an error

dusk pawn
#

Oh, okay.

thick schooner
#

Done