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

Is there a faster way to do this?

Is there a faster way of changing text rather than doing it the way below?

TextBox.Text = "W"
wait(.05)
TextBox.Text = "We"
wait(.05)
TextBox.Text = "Wel"
wait(.05)
TextBox.Text = "Welc"
wait(.05)
TextBox.Text = "Welco"
wait(.05)
TextBox.Text = "Welcom"
wait(.05)
TextBox.Text = "Welcome"

2 answers

Yes, there is, and it requires using a for loop;

-- Edited, thanks BlueTaslem for pointing that all out to me

local Welcome = "Welcome" --Heres our string

for i = 1, #Welcome do --Heres our for loop
TextBox.Text = Welcome:sub(1,i)) --It is going to doing something like this each 0.05 seconds; w, we, wel, welc, welco, welcom, welcome
wait(.05) --Waits 0.05 seconds before putting the next character
end --The end for the for loop

Hope this helped!

3 comments

0

The tostring is redundant, unnecessary. You have the parameters of string.sub backwards! 1, i not i, 1! In addition, you can use Welcome:sub instead of string.sub(Welcome,

0

Thanks! Can you breakdown tostring(string.sub(Welcome,i,1)) for me?

0

"substring" means a part of a string. The first one is where to start, the second one is where to end. So 1, i would be the first i characters. Note that the answer has them backwards: it should be written 1, i not i, 1

Yes just do it WEL WELCO WELCOME

try this that what i did

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