✓ Accepted answer
The reason this happens is because there's no delay between changes of the text. You can easily fix this by adding a wait:
local String = "Hello World!"
local text = script.Parent.TextLabel
for i = 1, #String do
if i%2 == 0 then
text.Text = ( string.sub(String,1,i) )
else
text.Text = ( string.sub(String,1,i) .. "_" )
end
wait(.1)
end
However, this won't get the effect you're looking for. You can get what you're trying to do with a few changes:
local String = "Hello World!"
local text = script.Parent.TextLabel
for i = 1, #String do
text.Text = String:sub(1, i)..(i < #String and '_' or '');
wait(.1);
end;
This adds an underscore after the text, unless it's the last character in the string.
You can read more about the ternary operator here and here.
Hope this helped.
EDIT:
As noted in chat, the above example would give you something like:
H_, He_, Hel_.
If you wanted H, H_, He, He_, you'll want something like this:
local String = "Hello World!"
local text = script.Parent.TextLabel
for i = 1, #String do
text.Text = String:sub(1, i);
wait(.1);
if i < #String then
text.Text = String:sub(1, i)..'_';
wait(.1);
end;
end;
Hope this helped.