Turning ALL children invisble

Hi, How can i turn everything inside a part invisible?

image

I would like to make everything inside rightarm (including all childrens of flashlight) invisible using a script.

for _, v in pairs(viewmodel.RightArm:GetChildren()) do
			if v:IsA("Part") then
				v.Transparency = 1
			end
		end

Usually works when it’s just a part but since this is a group, it doesn’t work. Can somebody please help me? Thanks

3 Likes
function Invis(inst)
    for _, v in inst:GetChildren() do
        if v:IsA("BasePart") then
            v.Transparency = 1
        end

       Invis(v)
    end
end

Invis(viewmodel)
2 Likes

Maybe it doesnt work because of the “if v:IsA(“Part”) then” statement, try to remove it

2 Likes
for _, v in pairs(viewmodel.RightArm:GetDescendants()) do
	if v:IsA("BasePart") then
		v.Transparency = 1
	end
end
3 Likes

ViewmodelModule:13: Transparency is not a valid member of Model

1 Like

This one works… Thanks!

dfjajhadjhdsadfs char limit

1 Like

Keep in mind for next time when you mean ALL children, the specific name for that is all the descendants

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.