I have a handgun holster and it has its own CFrame which is relative to the dummy’s HumanoidRootPart, and I want to weld it to a player’s HumanoidRootPart while keeping the same relative position and orientation. How do I do that? I tried the following but I got odd results.
function module:Weld(part0: BasePart, part1: BasePart, inverse0: CFrame, inverse1: CFrame): Weld
local weld = Instance.new("Weld")
weld.Part0 = part0
weld.Part1 = part1
if inverse0 and inverse1 then
weld.C0 = inverse0:Inverse()
weld.C1 = inverse1:Inverse()
else
weld.C0 = part0.CFrame:Inverse()
weld.C1 = part1.CFrame:Inverse()
end
weld.Parent = part1
return weld
end
local weld = Util:Weld(character:FindFirstChild("Torso"), root,
character.PrimaryPart.CFrame,
gear:FindFirstChild("CFrameInfo").Value:ToObjectSpace(character.PrimaryPart.CFrame)
)
It will center the handgun holster to the humanoidrootpart instead of keeping its relative cframe resulting in the handgun holster being placed inside of the player’s torso which is not what I want to achieve.