Frame visibility issues

I tried to create a script that makes a frame visible on part touch. For some reason, it only works once.
How can I solve this?

local Part = script.Parent
local Players = game:GetService("Players")
Part.Touched:Connect(function(Hit)
	if Hit.Parent:FindFirstChild("Humanoid") then
		local Char = Hit.Parent
		local Player = Players:GetPlayerFromCharacter(Char)
		if  Player.PlayerGui.ShopGui.Frame.Visible == false and Player.PlayerGui.ShopGui.Close.Visible == false then
			Player.PlayerGui.ShopGui.Frame.Visible = true
			Player.PlayerGui.ShopGui.Close.Visible = true
		elseif Player.PlayerGui.ShopGui.Frame.Visible == true and Player.PlayerGui.ShopGui.Close.Visible == true then
			print("GuiAlreadyVisible")
		end
	end
end)
local Players = game:GetService("Players")
local Part = script.Parent

local Debounce = false

Part.Touched:Connect(function(Hit)
	if Debounce then
		return
	end
	
	local HitModel = Hit:FindFirstAncestorOfClass("Model")
	if HitModel then
		local HitPlayer = Players:GetPlayerFromCharacter(HitModel)
		if HitPlayer then
			Debounce = true
			local Frame = HitPlayer.PlayerGui.Frame
			local Close = HitPlayer.PlayerGui.Close
			Frame.Visible = not Frame.Visible
			Close.Visible = not Close.Visible
			task.wait(3)
			Debounce = false
		end
	end
end)