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

How do I disable a typewriting GUI when its finished being presented?

Asked by 3 years ago

Long story short, I can't figure out how to get rid of the GUI when the typewriting is done being presented to the player.

My attempt to disable it is ,"local Parent.Enabled = false" but the . has the syntax error line under it.

local TextLabel = script.Parent:WaitForChild("Main"):WaitForChild("Text")

wait(1)

local function typewrite(object,text,length)
    for i = 1, #text, 1 do
        object.Text = string.sub(text,1,i)
        wait(0.02)
    end
end

typewrite(TextLabel,"Welcome to Car Factory Tycoon!",0.02)
wait(2)
typewrite(TextLabel,"Claim a Tycoon to begin!",0.05)
wait(2)

local Parent.Enabled = false

1 answer

Log in to vote
0
Answered by 3 years ago

This is because your attempt is using Parent.Enabled as a variable. When you put local Parent.Enabled, the code assumes you want to assign the Parent variable a value. To disable, you remove local. Just do

Parent.Enabled = false
Ad

Answer this question