Text Button not working

Hello, currently I have a problem where I can’t open a gui/tween a gui it responds with no inputs too.
Script:

--Open and Close
for _,object in pairs(script.Parent:GetChildren()) do
   print(Object.Name)
	if object:IsA("ScreenGui") and object:FindFirstChild("BackgroundFrame") then
		
		local Open = object:WaitForChild("OpenFrame"):WaitForChild("OpenButton")
		local Background = object:WaitForChild("BackgroundFrame")
		
		if Open and Background then		
			
			Open.MouseButton1Up:Connect(function()
				print("Clicked")
			end)
		end
	end
end

Here’s how my gui is set up:
Screenshot 2022-02-24 074612
Here’s what is prints out:

BubbleChat
Freecam
MainScript

Thank you in advance.

Make Sure The Button is Active

image

Yes, the button is activated. Thank you for your help though.

Maybe the problem is the way you are checking the objects.

Try using this code:

local plrGui = script.Parent -- assuming that this script is in PlayerGui

for _, object in pairs(plrGui:GetChildren()) do
	if object:IsA("ScreenGui") and object.Name == ShopGui then

		local Back = object:FindFirstChild("BackgroundFrame")
		local Open = object:FindFirstChild("OpenFrame")

		if Back and Open then
			Open.OpenButton.Activated:Connect(function()
				print("Clicked")
			end)
		end
	end
end

Still no input, here’s a link to it if you want to test it out for yourself.
https://www.roblox.com/library/8923612522/ShopGui
I wasn’t able to make download cause my pc can’t handle it sorry.
Edit:
I forgot to put the script mb.

I cant get on studio right now, since im on laptop, I apologize.

Now just gonna ask, do you really need to have the script as the direct child of PlayerGui? Why not just move the script in the ShopGui?

Edit: Nvm

I realized that the error wasn’t the script, but a script before it. Thank you!

Oh, lol. Well Im glad your problem has been solved :smiley: Happy to help!

I think the problem was the script name was “MainScript.”