How to use GetChildren() to weld a bunch of parts together at once?
The model I am making is a drawer with a bunch of cups inside of it. I inserted a Script into the part of the model that the cups are attaching to so I could weld them together. However, since the cups are all the same and there is a lot of them, I don't want to weld them individually, so I tried to weld them all at once:
01 | drawers = script.Parent |
03 | cups = drawers.Parent.Cups:GetChildren() |
04 | for _, child in ipairs (cups) do |
05 | CupWeld = Instance.new( "Weld" ) |
06 | CupWeld.Parent = child |
08 | CupWeld.Part 1 = drawers |
09 | CupWeld.C 0 = CFrame.new(child.Position.x,child.Position.y,child.Position.z)-Vector 3. new(drawers.Position.X,drawers.Position.Y,drawers.Position.Z) |
This works, sort of. The cups DO weld to the drawers, but they are all in one place. I want them to be in the position they were in before the script is run.