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

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

Asked by 6 years ago
Edited 6 years ago

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

3 answers

Log in to vote
0
Answered by 6 years ago

make it a localscript inside of the TextLabel.

wait(10)
script.Parent:Destroy()
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. hiimgoodpack 2009 — 6y
0
i mean, i thought it'd be self explanatory. It waits 10 second and destroys the scripts parent. creeperhunter76 554 — 6y
0
This didn't work for me. It didn't remove anything. Master3395 10 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

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
Log in to vote
0
Answered by 6 years ago

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

0
try a waitforchild, it might be because it hasn't loaded yet. Viking359 161 — 6y
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. Viking359 161 — 6y

Answer this question