Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I define the children of a parent?

This is a snippet of a script, and it doesn't seem to work. Help!

script.Parent.Children.Transparency = 1

It says that Children isn't defined!

1 answer

If you wanted all the children of a parent to have a transparency of 1, this is how you would do it:

local Children = script.Parent:GetChildren() --GetChildren() returns a table containing all the children of the parent
for _,v in pairs(Children) do --This is a "special" for loop that iterates through every element of a table
	if v:IsA("BasePart") then --If the child is a part...
		v.Transparency = 1
	end
end

Hope this helped!

Note: If you still have trouble with GetChildren(), click here: GetChildren()

This discussion is preserved as it was. New answers, comments, and votes are closed.