Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I destroy a PlayerGui by using MouseButton1Click?

Okay I am experimenting with GUI's and I'm trying to hide or destroy a GUI button when clicked. I've made this code but it doesn't work.

function onClick()
game.Players.LocalPlayer.PlayerGui.ScreenGui:Destroy()
end

LocalScript.Parent.MouseButton1Click:connect(onClick)

2 answers

✓ Accepted answer

That's because it's not "LocalScript" even if it is in a local script, It's still just "script"

1 comment

0

Thanks.

function onClick()
script.Parent:remove()
end
script.Parent.MouseButton1Click:connect(onClick)

It is not a Even if it is a local script you still use script. Also, try using regular scripts.

This discussion is preserved as it was. New answers, comments, and votes are closed.