local Frame = game.StarterGui.ScreenGui.Frame script.Parent.MouseButton1Click:Connect(function() print("hi") Frame.Visible = false end)
I believe that you have to use a text or image button and then use .MouseClick
Make sure you are having a local script and you are doing it wrong because you are getting the server's GUI which is not in the player. To get the player, type
local Frame = game.LocalPlayer.PlayerGui.ScreenGui.Frame script.Parent.MouseButton1Click:Connect(function() print("hi") Frame.Visible = false end)