Your script spam my console with that
Is the script placed inside the requested TextLabel, and, is the TextLabelâs text made of numbers only?
The text label have to contain letters.
Remove that â+â then.
If it doesnât work I will try to rewrite it.
Then Ig you can create a NumberValue inside the TextLabel, named âCurrentNumberâ, and try this:
local runService = (game:GetService("RunService"));
function Lerp(a, b, m)
return a + (b - a) * m
end;
local SPEED = (15);
local numberGoal = (0); -- // Change it when needed to update the display
local currentNumber = (script.Parent:WaitForChild("CurrentNumber"));
function TextUpdate(dt)
currentNumber.Value = math.ceil(Lerp(currentNumber.Value, numberGoal, dt * SPEED))
script.Parent.Text = tostring(currentNumber.Value)
end;
runService.Heartbeat:Connect(TextUpdate)
Edit: Worked very well or me. It basically doesnât rely on the TextLabelâs text, considering it has string-characters too, and not only numbers, therefore causing the issue you mentioned above. Instead, it relies on the âCurrentNumberâ value, whichâs value is ALWAYS going to be a number, therefore not breaking the code.
Id guess the main reason theyre all erroring is because everyone is trying to assume what you havent explained, to be completely blunt about it
Can you explain EXACTLY what youre trying to do, exactly what your current setup is, and other important stuff like:
About how often is the value changing? How quickly do you want it to move? Etc
Anything that could be useful to getting your topic solved
Pictures are worth a thousand words
I have a text label inside a surface gui.
I want the text label to change one by one to the value number.
I donât know how to explain it
The script spams errors because Heartbeat is a faster replacement of wait(). Please correct me if I am wrong
.Heartbeat fires every time a Frame is fired, therefore, if average FPS is 60 fps, itâs going to print out
the error if it reoccurs constantly approximately 60 times a second.
When i change the value CurrentNumber the script donât go to the value i set and reduce it
I gonna make a gif of what i want
Oh and the value is in the workspace in a folder. I donât want the value to be animated. ONLY the text on the surfacegui.
script.Parent.Text = tostring(Lerp(tonumber(script.Parent.Text),currentNumber.Value, dt * SPEED))
You can use TweenService to tween the position of the GUI when the value is being updated
i donât want to tween the position of the gui
What does the output say, and where did you put the script?
Edit: You donât need to change CurrentNumber, but numberGoal.
I put the script inside the text label