Open gamepass shop script not working

I tried to create a button that opens a gui but it does not work
script:

local gui = game.StarterGui.GamepassShop.Frame
 if script.Parent.MouseButton1Click:Connect(function()
	end) then
	gui.Visible = true
end
if not script.Parent.MouseButton1Click then
	gui.Visible = false
end

This is where the script is located:
image
It is inside the text button in the bottom

local Button = script.Parent 
local Shop = Button.Parent 
local gui = Shop:WaitForChild("Frame")

Button.Activated:Connect(function()
	--gui.Visible is a boolean value so not gui.Visible reverses it
	gui.Visible = not gui.Visible
end)
local frame = script.Parent.Parent
local button = script.Parent

button.MouseButton1Click:Connect(function()
	frame.Visible = not frame.Visible
end)

This will toggle the visibility of the frame when the button is clicked (bare in mind because the button is a child of the frame it will turn invisible whenever the frame is invisible, you may want to move the button into the ScreenGui itself.

local frame = script.Parent.Parent.Frame
local button = script.Parent

button.MouseButton1Click:Connect(function()
	frame.Visible = not frame.Visible
end)

This would be if the button was parented to the ScreenGui itself.