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

How do you make text on a Surface/ScreenGUI animate so it looks like it is typing itself out?

Asked by
Lualaxy 78
6 years ago

Hello! Im currently wondering how you make a text animation that looks like its typing itself out. I don't have any scirpts to share since I have no clue how to start.

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

There are a few ways, you can do it from nothing and keep changing the text, but that's lots of work, or you could use some string stuff and loops :)

You would need to use string.len and string.sub like you can see in the example below

local sentence = 'I like programming with roblox studio :)' -- The thing you want it to type out
local label = script.Parent -- Your textlabel

local len = string.len(sentence) -- It gets the lenght of your string


repeat -- Isn't neccesary, it just makes it so it loops
    wait() -- pretty neccesary if you don't want your studio to crash xD
    n = 0 -- Sets n (position) to 0
    repeat -- Loop is neccesary if you don't want it to do manually
        wait(0.2) -- Waittime
        n = n + 1 -- Add to position with 1
        label.Text = string.sub(sentence,1,n) -- Sets the text using string.sub
    until n >= len -- Waits for the lenght to be the same as the position
until false

You could also add a sound if you want, a good one is https://www.roblox.com/library/172065335/typewriter-key-1

Edit for mouseclick :)

0
I added how to script works using comments inside the script, you should also ready the wiki about this here https://wiki.roblox.com/index.php?title=Global_namespace/String_manipulation. :) User#20388 0 — 6y
0
Thank you :D Lualaxy 78 — 6y
0
Np :) User#20388 0 — 6y
0
How do I stop the repeat? Lualaxy 78 — 6y
View all comments (10 more)
0
What do you mean?, You can remove the first repeat and the until false at the end if that's what you mean User#20388 0 — 6y
0
No, if I do that it only spells out the first letter :| because im doing it with a click of a TextButton on a SurfaceGUI Lualaxy 78 — 6y
0
Just the first loop, not both? User#20388 0 — 6y
0
I'll edit the script for you, wait a sec User#20388 0 — 6y
0
Wait a sec, are you using a billboardgui then? User#20388 0 — 6y
0
Im using SurfaceGui Lualaxy 78 — 6y
0
Then it should just be the second repeat that you need User#20388 0 — 6y
0
This works, nice! Skepticalitys 31 — 6y
0
How do I program the sound into the Type Animation? Skepticalitys 31 — 6y
0
after the wait(0.2) do Effect:Play(), you should add a sound somewhere next to the script and do something like this local Effect = script.Parent:WaitForChild('Sound') and don't set the sound to playing User#20388 0 — 6y
Ad

Answer this question