I wanna get a Number

Um i wanna make it so the variable Kontostand finds a random number between 0-1000
And i wanna make it so that the message of the scoreboard is set to (“Dein Kontostand liegt bei:”)
and then after the double-dot The number which got choosen randomly stands then there.
so it have to be like that:

scoreboard.message(“Dein Kontostand liegt bei: 189(or something”);

My code:
https://is.gd/3RTEgB

To set the message, you call setMessage() instead of message(). Also, you cannot set the message inside of the addScoreboard() function since Kontostand is not defined until after the addScoreboard() function is called.

This should do the trick:

  var scoreboard = addScoreboard();
  var Kontostand = Math.round(1000 * Math.random());
  
  scoreboard.setMessage('Dein Kontostand liegt bei: ' + Kontostand);

  function addScoreboard() {
    var scoreboard = new Scoreboard();
    return scoreboard;
  }

-Chris