Hello I made a CloseButton for my HandToGui. I tried to fix it myself but i dont get it ^^'. Heres the script and a screenshot of my Explorer. I want to destroy the Gui with this button. The GUI is positioned in PlayerGUI. But when i click the button nothing happens. I hope somebody can help.

view source

local p = game.Players.LocalPlayer
 
script.Parent.MouseClick:Connect(function()
  	local PlayerGUI = p.PlayerGui
	local HandToGui = script.Parent.Parent.Parent.Parent
	    HandToGui:Destroy()
	end)

Screenshot: https://ibb.co/9nB1PKW

3 comments

0

try changing the script to a localscript

0

It needs to be in a LocalScript.

0

Thanks