I have a button in my ScreenGui that when pressed is supposed to destroy the ScreenGui it is apart of. When I test this in a local server on Studio, when the button is pressed, the ScreenGui itself disappears, but the actual item in the PlayerGui is still there.
Why won't the ScreenGui be destroyed?
Here's the code:
script.Parent.MouseButton1Click:Connect(function() --script.Parent is the TextButton
script.Parent.Parent:Destroy() --script.Parent.Parent is the Gui
end)

6 comments
try making the gui a variable, so local gui = script.Parent.Parent (make sure you check your output) then do gui:Destroy()
Already tried that.
is your script a local script? If not convert it
Server scripts can't make changes to the clients gui, only local scripts can
Yeah I'm sure its not a local script or else this should work. ^^
It's a local script.