How to use the new typewritter effect?

Title is self explanatory, how do i use the Typewritter effect in studio using Textlabel.MaxVisibleGraphemes

1 Like

This should explain it:

I wouldnā€™t make this thread if i didnā€™t had read that first, i did not understand it.

AlvinBlox made a video about it, this should teach you.

2 Likes

you gotta change the maxvisiblegraphemes repeatedly using for loop,Example:

local TextLabel=script.Parent
for i =1,10,1  do
   TextLabel.MaxVisibleGraphemes = i
end

--change that 10 value to how many characters are in your textlabel
--in a local script
--You can also do this
local Text=script.Parent.Text
local TextLength=string.len(Text)
for i =1,TextLength,1  do
   TextLabel.MaxVisibleGraphemes = i
end

this script you dont have to do set the text character count like before as it automatically gets its character count

1 Like

This isnā€™t even the new typewriter effect itā€™s outdated.

1 Like

Thatā€™s for the former method, @OP is asking how to use MaxVisibleGraphemes. (very late I know I was writting a lot)

For @Faczki, to explain, letā€™s first understand a code example they used, which is probably the recommended way to go instead of getting the length of the string and using a for loop, due to how it has trouble with localized letters or emojis.

Weā€™ll only focus on the things that are important so some parts are removed for clarity, suhc as the Richtext tag removal.

local displayText = script.Parent.Text

local index = 0
for first, last in utf8.graphemes(displayText) do 
	index += 1
	script.Parent.MaxVisibleGraphemes = index
	wait()
end

Before anything, letā€™s understand how MaxVisibleGraphemes work, itā€™s basically a property that determines how many letters/symbols can be on a GuiObject. If itā€™s -1, it means thereā€™s no limit, if itā€™s set to 10 as an example, it only allows 10 symbols to be on the object at a time, even if there are more.

Now, the next thing to understand is utf8.graphemes, itā€™s an iterator function, similar to how pairs and ipairs work. It returns 2 things, the first and last indexes, which is basically in shorter terms, the previous character index and the next character index if Iā€™m correct, basically just used to get the current character the loop is in, the returns can be ignored if you just want a simple typewriter effect. The function expects at least one argument, the string to go through

The loop in our example is basically just going to increment index by one, and setting the MaxVisibleGraphemes of the GuiObject to the number in the index variable, which effectively shows more text at a time, then it yield for a short time before repeating so the text is not written instantly

If you want the current character, in the loop, you can just add a few lines, example

local displayText = script.Parent.Text

local index = 0
for first, last in utf8.graphemes(displayText) do 
	local grapheme = displayText:sub(first, last)
	print(grapheme)
	index += 1
	script.Parent.MaxVisibleGraphemes = index
	wait()
end

This just prints the current grapheme

And to end it off, a grapheme is basically just a letter or a symbol taht represents speech. Please tell me if you have anymore questions!

6 Likes