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

need help getting my script to work removing a textlabel in a gui?

I'm trying to make it so after around 5 - 10 seconds, a script removes a textlabel that is inside my main gui. But for some reason, my script doesn't remove it.

Below is the script currently in the "remove" script. Not sure if localscript is better for this. Not sure if my script is the way to go eather.

wait(15)
script.Parent:remove()
print("NameGui removed.")

Below is the image of what i want removed. The textlabel named "Text"

click here

1 comment

3 answers

make it a localscript inside of the TextLabel.

wait(10)
script.Parent:Destroy()

3 comments

0

Explain your answer in English. Don't just post code; this doesn't help the poster or the community understand why the code does what it does.

0

i mean, i thought it'd be self explanatory. It waits 10 second and destroys the scripts parent.

0

This didn't work for me. It didn't remove anything.

Make sure this is in a LOCAL SCRIPT

--Setup Variables
local WaitTime = 15 -- Change to the amount of seconds you want
local IsButton = false --If you want a button to destroy it, change to true
if IsButton == true then
	local Button = script.Parent.Parent.Button --Change to the button's path
	else
	local Button = nil
end
local ObjRemove = script.Parent --Change to the Label's path
--Code
	if IsButton == true then --There is a button
		Button.MouseButton1Click:Connect(function(Player) --On Clicked
		ObjRemove:Destroy()
	else --If you just want it to wait
		wait(WaitTime) --Wait
		ObjRemove:Destroy() --Destroy
	end

Non of the solutions over worked. I've tried them all as eather Script or LocalScript.

2 comments

0

try a waitforchild, it might be because it hasn't loaded yet.

0

Try my script again. I've tested it and it works with and without FE. If that doesn't work, and none of the others work, the problem isn't in the scripting.

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