Transparency of specific model changing when guibutton clicked

Hello! I have been trying to make a script wich when I click the parts within the model changes

https://gyazo.com/54dede4530d464ca9db71e07f85b34c0

My script

local P = script.Parent
local Parts1 = P.Parent.Parent.Parent.Air3.Open:GetChildren()
local Parts2 = P.Parent.Parent.Parent.Air3.Shut:GetChildren()
local roofOpen = false

P.MouseButton1Click:Connect(function()
	if roofOpen then
		for i,v in pairs(Parts1) do
			v.Transparency = 1
		end
		for i,v in pairs(Parts2) do
			v.Transparency = 0
		end
	else
		for i,v in pairs(Parts1) do
			v.Transparency = 0
		end
		for i,v in pairs(Parts2) do
			v.Transparency = 1
		end
	end
	roofOpen = not roofOpen
end)

If this GUI gets parented to PlayerGui then Parts1 & 2 are going to be “PlayerGui” so you’re essentially trying to search for “Air3” inside of playerGui when it doesn’t exist

you would need to change it to workspace.MainParts.Air3.Open:GetChildren() and so on

https://gyazo.com/82bc6636f7c631514fe1db79291dcb0f
No it isnt a part of the textguibutton

show us your code because I think you’ve done something wrong and also can you send me a screenshot of the whole explorer with workspace open

local P = script.Parent
local Parts1 = P.Parent.Parent.Parent.Air3.Open:GetChildren()
local Parts2 = P.Parent.Parent.Parent.Air3.Shut:GetChildren()
local roofOpen = false

P.MouseButton1Click:Connect(function()
	if roofOpen then
		for i,v in pairs(Parts1) do
			v.Transparency = 1
		end
		for i,v in pairs(Parts2) do
			v.Transparency = 0
		end
	else
		for i,v in pairs(Parts1) do
			v.Transparency = 0
		end
		for i,v in pairs(Parts2) do
			v.Transparency = 1
		end
	end
	roofOpen = not roofOpen
end)

I sended it in the main, also here is what it looks like within the model

https://gyazo.com/54dede4530d464ca9db71e07f85b34c0

try this

I’m assuming MainParts is a child of workspace and not a child of another model

No its on a gui, do you want me to send the full like thingy?

https://gyazo.com/07f650907b6e37fecafc32baa5a4bc61

yeah just change

local Parts1 = workspace.MainParts.Air3.Open:GetChildren()

to where its located