local text = "Hello Rats!"
wait(2)
local text = "Yeah haw" -- This is my Text.
for i = 1, #text do
script.Parent.Text = string.sub(text, 1, i)
wait(0.04) -- Speed of the text Typewriter animation
end
✓ ANSWER ACCEPTED
How to I make my text change to my next bit of text?
2 answers
✓ Accepted answer
You could put the sentences in a table and loop through the table.
--table containing all the sentences
sentences = {
"Hello Rats!",
"Yeah haw",
"This is another sentence!"
}
--Displays current sentence with type writer effect
function displaySentence(sentence)
for i = 1, #sentence do
script.Parent.Text = string.sub(sentence, 1, i)
wait(0.04) -- Speed of the text Typewriter animation
end
end
--loop thru all the sentences, displaying each sentence
--with a 1 second pause in between each sentence
for _, sentence in pairs(sentences) do
displaySentence(sentence)
wait(1)
end
Answered
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
It says in the output 17:35:22.266 - Players.bailley5.PlayerGui.ScreenGui.TextLabel.Script:12: bad argument #1 to 'sub' (string expected, got nil)
my bad, text should be sentence i fixed that
Thanks