Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make text on a Gui dissappear?

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

✓ Accepted answer

You could hide the element:

myVar.Visible = false

or simply clear the text:

myVar.Text = ""

This discussion is preserved as it was. New answers, comments, and votes are closed.