Ok, I'm trying to make a SurfaceGui Textlabel that is empty but when you click it it has some text...? A script I tried was something like ~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~OnMouseClicked Part.SurfaceGui.TextLabel.Text = Chairman wait(10) Destroy() end
Well, TextLabels don't have a click event, but TextButtons do! You just need some quotes on your string, fix your hierarchy and you're good!
script.Parent.MouseButton1Down:connect(function() script.Parent.Text = "Chairman" wait(10) -- Not sure if you wanted to destroy the part, SurfaceGui, or the message. --[[ If you want to destroy the part: script.Parent.Parent.Parent:Destroy() If you want to destroy the GUI: script.Parent.Parent:Destroy() If you want to delete the TextButton script.Parent:Destroy() If you want to clear it: script.Parent.Text = "" --]] end)
So here's the hierarchy I set this up for (The location, or directory):
Workspace>Part>SurfaceGui>TextButton>Script
A TextLabel does not respond to clicks. You need to use a TextButton instead.
local TextButton = Part.SurfaceGui.TextButton TextButton.MouseButton1Click:connect(function() TextButton.Text = "Chairman" wait(10) TextButton:Destroy() end)
I'm not sure what element you were wanting to destroy in the code sample you provided. Mine destroys the TextButton