Positioning a part between 2 parts

I tried this, but it doesn’t work;

part.CFrame = (part1.CFrame - part2.CFrame.p)

You could use the Lerp function of CFrame. It basically calculates a new cframe between another a cframe and another using your second argument.

Here is an example:

part1.CFrame = CFrame.new(0,0,0)
part2.CFrame = CFrame.new(1,1,1)
part.CFrame = part1.CFrame:Lerp(part2.CFrame, .1) -- The CFrame is now (0.1,0.1,0.1)

-- To solve this:
part.CFrame = part1.CFrame:Lerp(part2.CFrame, .5)
1 Like

Well I already figured it out, but thanks. If anyone’s confused of how to do this for cframing here’s your answer;

part1.CFrame = CFrame.new((part2.Position + part3.Position)/2)