How do i add another text after the effect?

Basically after the first text is done I want the next text to appear with the affect.

for example: text1 gets type written and once it’s done text2 starts to type write!

my code:

local player = game.Players.LocalPlayer

local text = script.Parent.Frame.TextLabel

local TEXT1 = "Hello, "..player.Name.." we need to get up and get out of this building and get to the Radio Tower!!!"
local TEXT2 = "So hurry up!"
local TEXT3 = "We only have limited time to get there before the bomb drops!!!"

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

I would imagine you could use another for loop to where you can have the first for loop handle iterating through each of the strings while the second for loop (inside of the first for loop), handles what it currently does and thats the type writing effect. This would also allow you to store the different strings in a table instead.

local tStrings= {
"string1";
"string2";
"string3"
}

for i = 1, #tStrings do
    for j = 1, #tString[i] do
       text.Text = tString[i]:sub(1, j)
       task.wait(0.1)
   end
   task.wait(3)
end

Nevermind I figured it out just now… is there a way I can make a Table with the texts and play them in the loop?

Just sent it above. should be able to help u out.

Ok thank you it works exactly like I wanted it!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.