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:

    script.Parent.Parent.Dialog.TextLabel.Text="H"
    wait(0.05)
    script.Parent.Parent.Dialog.TextLabel.Text="He"
    wait(0.05)
    script.Parent.Parent.Dialog.TextLabel.Text="Hel"
    wait(0.05)
    script.Parent.Parent.Dialog.TextLabel.Text="Hell"
    wait(0.05)
    script.Parent.Parent.Dialog.TextLabel.Text="Hello"
    wait(0.05)
    script.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 :)

local text = "Whatever text you want this to be"

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

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

local Words = {"H","e'","l","l","o","."}

local function Type()
    for i,v in pairs(Words[i]) do
        wait(0.05)
        script.Parent.Parent.Dialog.TextLabel.Text=script.Parent.Parent.Dialog.TextLabel.Text..v
    end
end

Type()

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 3 years ago

how do i get to that tho

Answer this question