Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need help connecting the parts?

Asked by 4 years ago

I tried to make a script that connects the parts together with rope.

What it supposed to look like

My attempt

Script:

function RopePoints()
    for i,b in next, script.Parent.Points:GetChildren() do
        if b:IsA("Part") then
            b.Name = b.Name..i
            local rope = Instance.new("RopeConstraint",script.Parent.Points)
            local attachment = Instance.new("Attachment",b)
            rope.Length = 1
            rope.Attachment0 = attachment
            for _,b2 in next, script.Parent.Points:GetChildren() do
                if b.Name == b2.Name then

                else
                    if b2:IsA("Part") then
                        if (b2.Position-b.Position).Magnitude <= 0.5 then
                            local attachment2 = Instance.new("Attachment",b2)
                            rope.Attachment1 = attachment2
                        end
                    end
                end
            end
        end
    end
end

Answer this question