I want to make it to where if you click a part, the gui would go away/ destroyed. My current script doesn't work. Here it is:
function onClicked(playerWhoClicked)
local guiName = game.LocalPlayer.PlayerGui.GameName -- Game name gui
wait(0.1)
guiName:Destroy()
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
The error says:
**LocalPlayer is not a valid member of DataModel
Help?

5 comments
Hope I helped! Please mark as answered if I did
The wait is pointless but the rest looks OK.
Yeah I've always been told that. The wait() is really useless unless in a loop. But it's a personal preference, I for whatever reason think it helps
It doesn't.
Alright thanks for the tip