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

why is this weld weird?

Asked by
theCJarmy7 1293 Moderation Voter
8 years ago
local function weldBetween(a, b)
    local weld = Instance.new("ManualWeld", a)
    weld.Part0 = a
    weld.Part1 = b
    weld.C0 = a.CFrame:inverse() * b.CFrame
    return weld
end

local weld = weldBetween(game.Workspace.spe, game.Workspace.eps)

this makes a weld between two parts. it does make the weld, but it puts part1 into the center of part0. im completely new to welds, and this script was even from the wiki. how do i have the parts stay in the right positions?

1 answer

Log in to vote
0
Answered by 8 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

Try this instead

local function weldBetween(a, b)
        local weld = Instance.new("ManualWeld", a)
        weld.Part0 = a
        weld.Part1 = b
        weld.C0 = a.CFrame:inverse()
        weld.C1 = b.CFrame:inverse()
        return weld
end

local weld = weldBetween(game.Workspace.spe, game.Workspace.eps)

0
well now the part goes to 0,0,0 theCJarmy7 1293 — 8y
0
The inverse cancels out the CFrame aquathorn321 858 — 8y
0
yea, but the parts still go weird theCJarmy7 1293 — 8y
Ad

Answer this question