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

How come the text of a textlabel isn't updating with the type writer effect?

Asked by 7 years ago

Here's my script;

local Clicker = game.Workspace:WaitForChild("ClickGiver").ClickDetector
local TextString = Clicker.Parent:WaitForChild("TextString1").Value
local AddedString = Clicker.Parent:WaitForChild("AddedString").Value
local ErrorString = Clicker.Parent:WaitForChild("ErrorString").Value
local YesNoGui = game.ReplicatedStorage:WaitForChild("YesNoGui")
local YesButton = YesNoGui.YesButton
local NoButton = YesNoGui.NoButton
local TextStringLength = string.len(TextString)
local AddedStringLength = string.len(AddedString)
local ErrorStringLength = string.len(ErrorString)
local TalkGui = game.ReplicatedStorage:WaitForChild("TalkGui")
local TextDisplayer = TalkGui:WaitForChild("ChatBubble")
local YesNoGuiCloned = false
local TalkGuiCloned = false

Clicker.MouseClick:connect(function(Clicked)
    wait()
    if not TalkGuiCloned then
        local CloneTalkGui = TalkGui:Clone()
        CloneTalkGui.Parent = Clicked.PlayerGui
        print("TalkGui been cloned!")
        TalkGuiCloned = true
        for i = 1,TextStringLength do
            wait()
            TextDisplayer.Text = string.sub(TextString,1,i)
            wait()
            if not YesNoGuiCloned then
                local CloneYesNoGui = YesNoGui:Clone()
                CloneYesNoGui.Parent = Clicked.PlayerGui
                print("YesNoGui Cloned!")
            end
        end
    end
end)

No errors but the text aren't changing or working, please help!

0
Maybe change TextDisplayer.Text = string.sub(TextString,1,i) to --> TextDisplayer.Text = TextDisplayer.Text..string.sub(TextString,1,i) Coasterteam 4 — 7y

Answer this question