Gui panel not detecting clicks

Wanna get my gui panel to teleport you to either a shop or a selling spot by firing an event with tele’s value.

Gui Script:

local function CDetect(Button)
	for _,v in pairs(packFull:GetChildren()) do
		if v:IsA("Frame") then 
			if Button and not inTween then
				Button.MouseButton1Click:Connect(function()
					packFull.Position = UDim2.new(0.5, 0, -0.5, 0)
					packFull.Visible = false
					print(Button.Name)
					if Button.Name == "Sell" then
						tele = "Sell"
					elseif
						Button.Name == "Upgrade" then
						tele = "Upgrade"				
					end
				end)
			end
		end
	end	
end	

PF.OnClientEvent:Connect(function(player)
	packFull.Visible = true
	inTween = true
	local Button
	-- Activate/Deactive Buttons --
	local function Activate()
		for i,v in pairs (packFull:GetChildren()) do
			if v:IsA("Frame") then
				Button = v:FindFirstChildWhichIsA("GuiButton")
				Button.Active = not Button.Active
			end
		end
	end
	
	Activate()
	packFull:TweenPosition(UDim2.new(0.5, 0, 0.5, 0))
	wait(2)
	Activate()
	inTween = false
	CDetect(Button)
end)

Problem is neither buttons are registering clicks which means tele’s value isn’t getting set and the player is going no where. Any ideas why this is happening?

Maybe try changing this line to

Button = v:FindFirstChildWhichIsA("TextButton") or v:FindFirstChildWhichIsA("ImageButton")

Why not just reference the object’s name itself?

We can’t really do that in this code since it’s checking the children of a Frame in a loop, that’s how @OP is trying to do it, but I don’t think you can use it on GuIButtons since they’re the base class for ImageButtons and TextButtons

Results are mostly the same except the exit button, which is working

[Edit: Ignoring the DRY rule seemed to work]