#How do I get a score from a scoreboard

1 messages · Page 1 of 1 (latest)

urban crow
#

Like
const score = <playersScoreFromaScoreboard>;
Also ik it's dumb but I just forgot how to do this without events
How do I make a runCommand or this thing up there working like every some ticks without any events or anything like that

frozen tusk
urban crow
#

Basically I want to connect these to use runCommand to display a score of a player with a titleraw command

urban crow
#

Ik I can just use the in game stuff like *

#

But that's for smth else

#

Oh wait nvm I need those separated

frozen tusk
#
system.runInterval(() => {
world.getAllPlayers().forEach(player => {

let score = get the score of the player you can use the wiki to learn how
player.onScreenDisplay.setTitle(`${score}`)
}
}, 40);```
urban crow
#

Bru that's what I need the let score = get the score I don't understand the wiki 😭

frozen tusk
urban crow
#

...

frozen tusk
#

getting the score of the player is basic knowledge so you should learn how

urban crow
#

.......

#

That's what I'm trying to do here

#

And ur not helping...

frozen tusk
urban crow
#

I don't need all that

#

I need that single line

urban crow
arctic bridge
arctic bridge
#

btw the <player> in getScore() method has to be Player class

arctic bridge
urban crow
#

alr thank u so much

#

if i want to do 2 of these do i have to copy the whole thing again (after the system.runInterval)

arctic bridge
#

and no, just do it inside the players loop

urban crow
#

lets say if i want to make a kills scoreboard and deaths and lets say ik how to

#

like how to add kills and deaths

#

now i want to display it without runCommand

#

i need to do const for the score right?

#

so like

#

i want 2 scores

#

kills and deaths

urban crow
#

i mean i need even more but its just to understand how to do two scores in the shortest way

arctic bridge
urban crow
#

alr

arctic bridge
cerulean heath
#
system.runInterval(() => {
    for (const player of world.getAllPlayers()) {
        const kills = getScore(player, "kills");
    }
})
arctic bridge
#

maybe that's the reason i had problems with getting scores