is this how you have to do it? script.Parent.Text = ('H') wait(0.2) script.Parent.Text = ('He') wait(0.2) script.Parent.Text = ('Hel') wait(0.2) script.Parent.Text = (Hell') wait(0.2) script.Parent.Text = ('Hello') wait(0.2)
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
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)