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

Is there a more efficient way of making a self typing speech bubble?

Asked by 5 years ago
--Variables
local speech = script.Parent.Speech

--Test
workspace.TestClick.ClickDetector.MouseClick:Connect(function()

    speech.Text = "H"
    wait(0.03)
    speech.Text = "He"
    wait(0.03)
    speech.Text = "Hel"
    wait(0.03)
    speech.Text = "Hell"
    wait(0.03)
    speech.Text = "Hello"

end)

Or do I have to type all of this out?

2 answers

Log in to vote
1
Answered by 5 years ago

No, you would not have to type this all out, simply copy the script below!

-- Variables

local speech = script.Parent.Speech
TextToType="Hello"

-- Code

workspace.TestClick.ClickDetector.MouseClick:Connect(function()
    for i=1,#TextToType do
        speech.Text = string.sub(TextToType,1,i)
    end
end)

Hope this helped <3

0
this is so much more useful! Tysm VeryDarkDev 47 — 5y
0
:D OkxieCorey 125 — 5y
Ad
Log in to vote
-1
Answered by 5 years ago
Edited 5 years ago

No, you would not have to type this all out! I call this the "Typewriting effect".

--Variables

local text = "Hello"
local speech = script.Parent.Speech

--Code

workspace.TestClick.ClickDetector.MouseClick:Connect(function()
    for i = 1, #text do
        wait(.05) --change the wait to make the typewriting effect slower/faster
        speech.Text = string.sub(text, 1, i)
    end
end)

0
All you did was copy the first answer... User#19524 175 — 5y
0
All you did was copy my answer. :P OkxieCorey 125 — 5y

Answer this question