#How do i save objects in the scoreboard database?

1 messages · Page 1 of 1 (latest)

abstract cape
#

At the moment, im trying to save a object to the scoreboard so i can retrieve it and then use it, cant figure out a way of doing this. ive tryed JSON.stringify doesnt work.

abstract cape
#

please guys

potent monolith
#

Arent scores supposed to be a number type

prisma mural
#

You can't get the string or you can't save the string in the scorebpard?

potent monolith
#

when adding scores using api,it has to be number type

#

convert it like:

let score = "60"
world.scoreboard.getObjective("obj").addScore(player, Number(score))
prisma mural
potent monolith
#

i dont exactly get what this is about sorry

prisma mural
potent monolith
#

ye i agree,the point of that is the Number()

#

calling the value inside the object is like this
score["xp"]

prisma mural
#

The scoreboard would only work if all your Object's properties were numbers or if you assigned a number combination to the values

potent monolith
#

Idk if it is trying to save the values of keys inside the object to scoreboard,because it has to do it manually per objective