I'm making a roblox airline and made it so that when you click the seat traytable it makes the bottom part visible. Instead of doing GetChildren() for the model I thought I would go the simple way and just manually set transparency for each one. But when I click it says union is not a valid member of model? Here is my explorer:
TrayTableDown Union Union1 Union2 Union3 Union4 Union5 Part Part1
And this is the script I'm using:
local parts = game.Workspace.TrayTableDown script.Parent.ClickDetector.MouseClick:Connect(function() parts.Union.Transparency = 0 parts.Union1.Transparency = 0 parts.Union2.Transparency = 0 parts.Union3.Transparency = 0 parts.Union4.Transparency = 0 parts.Union5.Transparency = 0 parts.Part1.Transparency = 0 parts.Part.Transparency = 0 script.Parent.Transparency = 1 end)
First of all, it may be due to that union not being anchored or other script deleting it. You can check ingame children of that model like this to make sure it's there.
local parts = game.Workspace.TrayTableDown --- Use this to see what children it has ingame for i,v in pairs(parts:GetChildren()) do print(v.Name) end
Or you could just set transparency with loop (I read that you don't want but in case I will leave it here):
local parts = game.Workspace.TrayTableDown for i,v in pairs(parts:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 0 end end