Use a private variable to store the number.
Use a sprite with 10 animations, each of which represents a number (from 0 to 9). Alternatively, just use 10 sprites, each representing a number. Whatever floats your boat.
For each digit in the variable, display that sprite/animation. You can use text manipulation or math manipulation to read digits.
In this case, we're using math manipulation. Divide by 1000 to get the thousands, 100 to get hundreds etc.; to get hundreds only, substract thousands you got from earlier... example:
Fifth digit: 1337/10000 rounded down equals 0, so display 0
Fourth digit: (1337 - Fifth digit * 10000) / 1000 rounded down equals 1, so display 1.
Third digit: (1337 - Fourth digit * 1000 - fifth digit * 10000)/100 rounded down equals 3, so display 3.
And so on till the first digit. I'm sure there is a simpler way to get digits.