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)
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)
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!
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)
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
I tried it but when I reset, it get reenabled. How do I fix this?
Just set ResetOnSpawn to false using the code