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

How do I make a button that destroys the gui?

Asked by 3 years ago

I made a script that deletes the GUI but when I reset, it's still there. Help.

script.Parent.MouseButton1Down:Connect(function()

    script.Parent.Parent.Parent:Destroy()

end)

3 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

So, instead of using :Destroy(), you can use Enabled property of ScreenGui, if you are intending to destroy the ScreenGui.

script.Parent.MouseButton1Down:Connect(function()
    script.Parent.Parent.Parent.Enabled = false
end)

If it's other than ScreenGui, leave the comment and I'll help you with that. Lemme know if it helps!

0
I tried it but when I reset, it get reenabled. How do I fix this? ILikeBaked_Beans 12 — 3y
0
Just set ResetOnSpawn to false using the code BestCreativeBoy 1395 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

This is very basic you use a local script and put it in the button and the script should be this:

script.Parent.MouseButton1Click:Connect(function()
    script.Parent:Destroy()
end)

That will remove it from the players GUI it you want it to still there do this:

Put a local script in the button and the script should be this:

script.Parent.ResetOnSpawn = false

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Enabled = false
end)
Log in to vote
0
Answered by
n_ubo 29
3 years ago

if you put your GUI inside StarterGui, it will reset after you respawn, unless you toggle of ResetOnRespawn in the properties of the Screen Gui meaning it will not refresh after you reload your character.

Answer this question