Like I wanted to make something on my TextLabel that typed for example "Welcome to my place" but it typed out every letter to make the word. Can anyone help me?
COMMUNITY QUESTION
How to make words that type?
1 answer
text = "Welcome to my place" --Some text to be "typed out" on the text label
textlabel = --Place TextLabel object here
for i = 1, #text do
textlabel.Text = string.sub(text, 1, i)
wait(.1)
end
So, we make some text to be typed out. We create a variable for the TextLabel object. Then, we create a numeric for loop, running code for each character in the text. Each time we loop, we add one character to the TextLabel's text. string.sub returns a substring from the text between the second and third arguments. For example:
text = "Hello world!"
print(string.sub(text, 1, 5))
That prints out "Hello". A substring between "i" and "i" would be "W", "We", "Wel", "Welc"... and so on. We then wait for a 10th of a second between iterations to simulate realistic typing speed.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
It's a bad idea to use
(i, i)-- you should use(1, i). Also remember how much cutertext:sub(1, i)is thanstring.sub(text, 1, i)!