How would I make this GUI say this number?

(Sorry if this is the wrong category, I’m new here. If its is, Please tell me and I will update it.)

  1. What do you want to achieve?
    I want to make the TextLabel GUI say the number that is at the top of the code “Num.”
    So it starts at 100 and keeps going down.

  2. What is the issue?
    Instead of saying the number, The GUI will just say “num”

  3. What solutions have you tried so far?
    I did try looking on the developer hub on the TextLabel.Text article, But it didn’t say anything about putting a number from a local variable in one.

Here is the code:
code

Try this:

text.Text = num

instead of text.Text = ("num"); you were setting the Text of the GUI to “num” every time, not to the value of the variable num

1 Like

As @Quackers337 has said change ("num") to just num.
It currently isn’t working as you are setting the text to a string value (the actual word num) rather than the value num which you have created as the local variable.

Like @Quackers337 said, text.Text = num is the way you should do it. Basically, you was trying to update a string but you was supposed to update the integer, so instead do this:

local text = script.Parent
local num = 100

while true do
     text.Text = num
     wait(.5)
      num = num - 1
end

Also you can do wait(.5) or wait(0.5), I would do wait(.5) because its easier.

TextLabels are intended to be filled with a string, not a boolean or number. I wonder when Roblox deprecate this.

We fix this issue using a slight change, using tostring() :

local text = script.Parent
local num = 100

while true do
     text.Text = tostring(num)
     wait(.5)
      num = num - 1
end

I hope that helped you and welcome to the Devforum!
:slight_smile:

3 Likes

Ah yeah, I forgot about that! Yeah, tostring is the only option because you cannot store an integer in the textlabel itself.

2 Likes