Why does this script not work, and has no output?

image

So the image above is my full code in a single script. My goal is to make the screen.Text change from the current temp (say 500, for example) and countdown to the new temp (for example, 400). I’m not sure if I even did it right, but there is no output in the Output tab and nothing happens while testing.
Any help is greatly appreciated.

1 Like

Hey there! The loop dosen’t work because it’s values are all messed up.
I’d suggest taking a look here!
https://devforum.roblox.com/t/how-to-make-a-for-i-loop-go-down-from-a-number-not-up/729058
Also there is no reason to convert the value to a string, it’s not necessary

2 Likes

Ohhhh, thanks. This is what I was looking for. Thanks.

Try setting a negative incrementer.

for i = temp.Value, 0, -1 do

end

Don’t forget to mark it as “solved” if this was the solution to your problem!

1 Like

What should I put in between the function? Should it be the output?

for i = temp.Value, 0, -1 do
     screen.Text = temp.Value
     print(temp.Value)
end

Like that, or is there something else?

Here:

for i = initialValue, goal, increment do

Is there a way to make it always update? I used a while true do, but crashed studio…

use a wait to prevent studio from crashing. while loops especially, run infinitely and not give other scripts time to execute their code so add a wait inside a while loop

1 Like