Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to make Appearing letters?

Hey i'm making a game and I need something. After you step on a certain brick a little message will appear saying: Hello and welcome to the world! I don't want to it to just appear though, I want it to appear letter by letter if that makes sense.

Like for example the letters will show up like this only it wont appear in rows it will happen all in 1 row. I don't want to have to add a letter every time so if you know an easy way to do this please tell me! W We Wel Welc Welco etc. i want it efficient though

message.Text=W
message.Text=We
message.Text=wel
message.Text=welc
message.Text=welco
message.Text=welcom
message.Text=welcome

1 answer

✓ Accepted answer

Let's say we have a finished string message. If we want to build the version of it growing one letter at a time, there's essentially two approaches that are very similar:

  • Grow the text by the ith character
  • Use the substring of the first i characters

They look like this:

Growing:

text = ""
for i = 1, #message do
	text = text .. message:sub(i,i)
	print(text)
end

Substring:

for i = 1, #message do
	text = message:sub(1,i)
	print(text)
end

I find the second approach to be much more elegant.

This discussion is preserved as it was. New answers, comments, and votes are closed.