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

How do I make text on a Gui dissappear?

Asked by
Peeshavee 226 Moderation Voter
7 years ago

What I mean is I have this script which runs a few lines of text, but when it finishes, the last piece of text stays. Here's the code:

local part = script.Parent
local db = false
local myVar = game.Workspace.Part.SurfaceGui.Test

function FindHat(hit)
    local hat = hit.Parent:FindFirstChild("SilverthornAntlers")
    local human = hit.Parent:FindFirstChild("Humanoid")
    if human and hat then
        if not db then
            db = true

        myVar.Text = ("HOW DARE YOU WEAR THAT WRETCHED HAT!?")
        wait(4)
        myVar.Text = ("YOU WILL BE SMITED BY MY WRATH!")
        wait(4)
        myVar.Text = ("DIE!!")
        wait(2)
        human.MaxHealth = 0
        wait(5)

        db = false



        end
    end 
end


part.Touched:connect(FindHat)

At the part where it says "DIE", my character dies, which is what I want it to do, but after, the "DIE" part stays on the Gui. Anyway to fix this?

1 answer

Log in to vote
0
Answered by 7 years ago

You could hide the element:

myVar.Visible = false

or simply clear the text:

myVar.Text = ""

Ad

Answer this question