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

How do I give a TextLabel in a ScreenGui a typewriter effect?

Asked by 7 years ago

It's obvious you can do this by doing:

01script.Parent.Parent.Dialog.TextLabel.Text="H"
02wait(0.05)
03script.Parent.Parent.Dialog.TextLabel.Text="He"
04wait(0.05)
05script.Parent.Parent.Dialog.TextLabel.Text="Hel"
06wait(0.05)
07script.Parent.Parent.Dialog.TextLabel.Text="Hell"
08wait(0.05)
09script.Parent.Parent.Dialog.TextLabel.Text="Hello"
10wait(0.05)
11script.Parent.Parent.Dialog.TextLabel.Text="Hello."

But I just want a simple function I can put my text into so that it does what I want easily.

4 answers

Log in to vote
5
Answered by 7 years ago
Edited 7 years ago

It's actually really simple, try this :)

1local text = "Whatever text you want this to be"
2 
3for i = 1, #text do
4    script.Parent.Parent.Dialog.TextLabel.Text = string.sub(text, 1, i)
5    wait(0.04) --This is the speed of the text
6end
0
how do i get to there superadnan543 0 — 4y
Ad
Log in to vote
0
Answered by 7 years ago

Put the individual characters you want typed into the table called Words

01local Words = {"H","e'","l","l","o","."}
02 
03local function Type()
04    for i,v in pairs(Words[i]) do
05        wait(0.05)
06        script.Parent.Parent.Dialog.TextLabel.Text=script.Parent.Parent.Dialog.TextLabel.Text..v
07    end
08end
09 
10Type()

Press view source to see the entirety of line 6, it's pretty long.

0
honestly sad man greatneil80 2647 — 5y
0
lmfao iuclds 720 — 5y
0
LOL Uzixt 19 — 4y
0
i was trying to do it for like a coin gui i have when it updates it want it to update like that iWasThisi -15 — 4y
0
That'll work, but there are MUCH better ways to do it than that!!!! LOL UltimateGameDudez 19 — 4y
Log in to vote
0
Answered by 4 years ago

This is fairly easy. Read this for information. https://developer.roblox.com/en-us/articles/animating-text

Log in to vote
0
Answered by 4 years ago

how do i get to that tho

Answer this question