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?
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.