How to use "TextTween" (Dont click if you want it smooth.)

wait but wouldn’t using a for i loop be more practical?

local Text = "EXAMPLE"
local waitTime = 0.05

local length = string.len(Text)
for i = 1, length do
	print(string.sub(Text, 1, length - (i - 1)))
	task.wait(waitTime)
end
11 Likes

This is a pretty horrible tutorial, So much so that there are plenty of ways to simplify this. One of the ways @Jexemie already pointed out.

But I’ll simplify his code:
instead of subtracting the index value, you can instead have a -1 as a third argument, this makes it so the loop subtracts the index instead of adding, you can also remove the use of string.len() and replace it with #string, but that’s basically syntactic sugar.

for i = #Text,0,-1 do
    task.wait(.05)
    Text = string.sub(Text, 1, i)
end
9 Likes

This would be making peoples code very long and inefficient.

1 Like

This is bad practice and will ultimately lead to performance issues. This is also way more time-intensive on the developer and requires constant edits. An alternative method such as the ones shown by @Jexemie or @KdudeDev are recommended and much better to use.

The best method is MaxVisibleGraphemes, which sets how many characters are visible.

MaxVisibleGraphemes = 0 means no characters are visible, MaxVisibleGraphemes = -1 means all characters are visible, and MaxVisibleGraphemes = N means N characters are visible, N could be any number.

You would just decrease this property by 1 in a for loop with string.len as the amount of loops.

TextLabel.MaxVisibleGraphemes = string.len("EXAMPLE")
TextLabel.Text = "EXAMPLE"

for i = 1, string.len(TextLabel.Text) do
    TextLabel.MaxVisibleGraphemes -= 1
end
9 Likes

Although this would work, a more proper effect would be with string.sub(), MaxVisibleGraphemes would just make the text invisible instead of making the text smaller.

However, it is a method

Roblox created MaxVisibleGraphemes for the purpose of typewriting, its even in the announcement post Typewriter Effect: New property MaxVisibleGraphemes (Live)

I don’t see how this would be a negative, I would want text to be the same size when its getting typed out, its more readable.

6 Likes

Generally yes, People would use this to make a Basic typewriter effect as I stated in my Featured Post, but people would still use string.sub() more over MaxVisibleGraphemes, plus other ways that are more complicated (I wont go over them as this is straying) to get a more cooler effect that MaxVisibleGraphemes cannot do.

I’m not saying you’re wrong, I’m saying that its more uncommon to find this method.

💀 Skull Emoji — Meanings, Usage & Copy

this is the most insufficient code ive ever seen
@Jexemie has a better example, you should learn more functions to upgrade your coding skills (like youtube tutorials, roblox creator docs)

4 Likes

I like my code more! :sweat_smile:

function del()
local Text = text.Text
local TextMINUS = string.sub(Text, 1, i)

if not game:getService("RunService"):IsClient() then return print("NO CLIENT") end

if TextMinus then
   Text = TextMINUS -- THIS WONT WORK :(

   text.Text = TextMINUS

   del()
end

del()

If you’re going to use a basic method (not MaxVisibleGraphemes or string.sub()), at least use loops to achieve this instead of the method you used.

What if I want the TextLabel to say “Once upon a time, there were many un-documented developers on the Roblox platform that don’t know how to use the properties tab”? Will I repeat the semtemce over and over with one character missing?

I’d recommend including images or videos. It’d probably garner your post a lot more attention.

For loops are part of The Basics. Learning how to be inefficient is not. Sorry, but I think you should learn some more scripting before making tutorials.

At least you are using task.wait() and not wait() lol.

But all seriousness it’s getting a little annoying with people making useless community “tutorials” that one could have learned by doing some basic research, with that in mind who exactly does this help?

Can’t say for beginners because if they are starting with insufficient code like such, it’s just dooming them from the start.

Please do proper research before making a community tutorial.

Clicked on this thinking it’d be a high quality resource

1 Like

I don’t think this is tweening

3 Likes

It appears that the code is not efficient at all…
( oh and by the way, this isn’t tweening in any way )

Not trying to sound rude to your post, but atleast attempt to learn how loops work.