Trying to do a script that when you click a button all the parts in the model "doors" become Transparent and CanCollide off, I dont want to have it so that every single individual part is listed in the script if possible, this is what i've thought will work but it dosent, any ideas?
function onClicked() game.Workspace.Door:GetChildren().Transparency = 1 game.Workspace.Door:GetChildren().CanCollide = false end script.Parent.ClickDetector.MouseClick:connect(onClicked)
GetChildren() gives you a table meaning you would have to do something like:
for i = 1, #game.Workspace.Door:GetChildren() do game.Workspace.Door:GetChildren()[i].Transparency = 1 game.Workspace.Door:GetChildren()[i].CanCollide = false end
If you put the script inside the Click Detector, you can do this :
script.Parent.MouseClick:connect(function() local door = game.Workspace.Door:GetChildren() door.CanCollide = false door.Transparency = 1 end)