For a sandbox/tycoon game im making, im trying to make a BillboardGUI with a TextButton that when you click it, it should delete a placed object. Here's the script:
function onClick()
script.Parent.Parent.Parent.Parent = nil
end
script.Parent.MouseButton1Click:connect(onClick)
When i click on the TextButton, it does nothing. How do i fix this?

2 comments
Do not set the parent to nil it will not safely delete the part use Destroy(). GUIs should be local only. User remote events / functions to make changes server side.
i replaced script.Parent.Parent.Parent.Parent = nil with print("success") and it still did absolutely nothing, with not even a single error message.