Change an Attribute of all Children with the same Name

I need some help with a script I’m programming. I want to get all the children with the same name and change some Attributes when a function gets activated.
But don’t know how I can do it. I already tried with GetChildren() but it ain’t working.
Please help me and thanks in advance :slight_smile:

What was your implementation with GetChildren (what code did you try)? I don’t see why that shouldn’t have worked

for i,v in pairs (<your object path here>:GetChildren()) do
v.<attribute here> = <value here>
end
1 Like

Where do I put the name of the parts I want to change?

GetChildren() gets all the children inside of an instance. If you’d like to change attributes of children that have a specific name, you do

local function changeAttributes(name)
    for _, child in ipairs(InstanceNameHere:GetChildren()) do
        if child.Name == name then
            --your attribute changing here
        end
    end
end
2 Likes

literally in the places where i put attribute here, your object path here, value here