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
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