How can I have a table of strings for a typewriter?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Hello, so I want to achieve an effect where the typewriter moves from one string to the next one.
  2. What is the issue? Include screenshots / videos if possible!
    Whenever I attempt to loop through the strings, I always get an error like invalid argument #1.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have watched tutorials covering, one string, but not multiple inside a table, as well as other posts relating to typewriting.
local MessageTable = {
	"So... you are new around here?",
	"Time to show you the ropes.",
}

I am awaiting responses. Help is appreciated.

Here’s how you can do it :

local TextLabel = script.Parent
local Table = {
	"Test",
	"Testtttt",
}

function TypeWriter(String)
	for i = 1,#String do
		script.Parent.Text = string.sub(String,1,i)
		task.wait(.2)
	end
end

for i,v in pairs(Table) do
	TypeWriter(v)
end
1 Like

It worked. Thank you! I feel dumb now :sweat_smile:
Turns out I was using a for loop (number) instead of a for i, v in pair loop.

1 Like

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