#what is bad in my code i don't understand
1 messages · Page 1 of 1 (latest)
And world.addObjectives and world.setObjective
Also, wrap inside system.runTimeout
It seems you didn't read the official documentation.
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)
})
})
//...
Is the spread operator really necessary, ie world.getAllPlayers() returns an Array of Players.
Oh, okay.
Done