I really need help, I'm getting REALLY stressed out. Anyway PLEASE help me! :) What's wrong with this?
local CV = script.Parent.C local C = script.Parent.C.Value for i = 1, 2500 do wait(0.01) if CV.Value < 2500 then CV.Value = CV.Value + 1 end end script.Parent.Text = C
To convert a number to a string, you use the tostring(number)
function. What this will do is attempt to convert the given number to a string, and then return that string. If no number is given, it returns nil.
tostring(50)
I'm not entirely sure what you're attempting to do. You have an if statement that affects the value of a NumberValue, but you're doing nothing to display the changing number to users.
On line 11, you set the text to whatever is was equal to at line 01, disregarding that C
is no longer equal to script.Parent.C.Value
(due to the for loop). If that's what you intend, it begs the question, why the loop?
We can make your loop more efficient, however, for you already have a variable (i
) that is changing, so you can use that to directly set the value.
for i = 1, 2500 do wait() --The minimum wait time is about a 30th of a second, so you can't make it wait only 1 hundredth of a second. CV.Value = i end