✓ Accepted answer
string.sub, or alternatively strName:sub, is the substring function. Basically, it gives you only the specified section of a string. The first number is the character you want to start at, and the second is the one you want to end at.
local str = "Hi there!"
print( str:sub(1, 5) )
Or alternatively,
print( string.sub("Hi there!", 1, 5) )
Although I prefer it in method form.
So, like I said before, the second number is where you want the section of the string to end. In the example above it ended at the fifth character. So to make a sort of typing simulation we have to increase that number once each time, e.g.
local str = "Hi there!"
print( str:sub(1, 1) )
print( str:sub(1, 2) )
print( str:sub(1, 3) )
print( str:sub(1, 4) )
etc.
But wait! What else do we know that can increase a number every time? A for loop.
local str = "Hi there!"
for i = 1, #str do
print( str:sub(1, i) )
end
1 comment
I don't have time to make a script, but here is what I'd do: Make a variable and set it to your string that you want. Then make a for loop that runs the length of how many digits are in your string. Then make a temporary variable that is set to the string variable, but cut down to the length of your loop iterator. Don't forget a wait() so it has some time.