Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do we make letters in a text dissapears one by one?

Asked by 5 years ago

So I want to make a NPC saying dialogs and the text appears letter by letter. I already know how to, but I also want to make them dissapear letter by letter. Here's my appearing letter script:

local text = "Hello!"

for i = 1, #text do
        script.Parent.Parent.Dialog.TextLabel.Text = string.sub(text, 1, i)
        wait(0.1) --This is the speed of the text
end

Help will be REALLY appreciated!

1 answer

Log in to vote
1
Answered by 5 years ago

You can basically just reverse your loop, and that's your disappearing script.

for i = #text, 1, -1 do     -- The third value here is the direction/step size of your loop
    script.Parent.Parent.Dialog.TextLabel.Text = string.sub(text, 1, i)
    wait(0.1) --This is the speed of the text
end

0
you tested? TheRealPotatoChips 793 — 5y
0
Thanks! TheRealPotatoChips 793 — 5y
Ad

Answer this question