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

Welding script not accurately welding parts?

Asked by 6 years ago

I need to have an unanchored model with multiple parts that I cant union so I have this to weld them together, it works but the parts welded are always in slightly different places making it look weird.

local weldTo = script.Parent:FindFirstChild('Plane')
local weldToCf = weldTo.CFrame:inverse()

local parts = {weldTo}

function Weld(parent)
    for _,v in pairs(parent:GetChildren()) do
        if (v:IsA("BasePart") and v ~= weldTo) then
            local w = Instance.new("Weld")
            w.Name = "PlaneWeld"
            w.Part0 = weldTo
            w.Part1 = v
            w.C0 = weldToCf
            w.C1 = v.CFrame:inverse()
            w.Parent = weldTo
            table.insert(parts, v)
        end
        Weld(v)
    end
end

Weld(script.Parent)

for _,v in pairs(parts) do
    v.Anchored = false
end

script:Destroy()

1 answer

Log in to vote
0
Answered by 6 years ago

Use this plugin

https://www.roblox.com/library/342043284/Live-Weld-Plugin-Born2Weld-Updated

It is sooo helpful! I could not get by without it! What you do is that you select the model after installing that plugin and then click on the plugin icon in the plugins section in studio then something should pop up in ur screen. Click on weld. it should be loading then say something like '(Model name) welded. Time Taken: (probably less than a second)'

Clicking remove welds will remove all the welds

U can tell if it worked by looking on explorer and noticing all the parts in ur models have a child called weld or something

Hope it worked boii

Ad

Answer this question