Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a textlabel text change by letter and not come in all at once?

3 answers

✓ Accepted answer

One method that you could use to achieve this is to create a for loop from 1 - length of string and display the first n letters of the string using string.sub()

Example:

local text = "Hello"

for i = 1, #text do
	TextLabel.Text = text:sub(1, i)
	wait(.2)
end

I hope this helps!

I guess that's one way to do it, but there's an easier way using String.sub and a for loop.


Using the for loop, you will use the length of the string to get the letters;

local str = "The text you want."
local textLabel = script.Parent -- Assuming this script is inside a TextLabel.

for i = 1, #str do -- In this case, it will start at 1 (T) and end at 18 (the period).
	textLabel.Text = str:sub(1, i)
	wait(.5) -- The longer you make the wait, the longer it will take to go to the next letter.
end

1 comment

0

You literally copied what I posted

while true do is optional Must be in a local script Local Script must be in TextLabel or TextButton

while true do
wait(math.random(1,2))
script.Parent.Text = 'H'
wait(math.random(1,2))
script.Parent.Text = 'He'
wait(math.random(1,2))
script.Parent.Text = 'Hel'
wait(math.random(1,2))
script.Parent.Text = 'Hell'
wait(math.random(1,2))
script.Parent.Text = 'Hello'
wait(math.random(5,10))
script.Parent.Text = ' '
end)

1 comment

0

Well I really wanted a quicker way to do what I was doing but you are just doing what I was doing but in a while true do function and my function is an ontouchedpart function and you are just making the waits longer and using math.random. Please don't answer if someone has already posted a better one

This discussion is preserved as it was. New answers, comments, and votes are closed.