How do I make a Motor6D from a script that doesn’t move the Motor6D.Part1?

How do I make a Motor6D from a script that doesn’t move the Motor6D.Part1?
This is what I mean when I say “from a script” :

local m6d = Instance.new("Motor6D", Part0)
m6d.Part0 = Part0
m6d.Part1 = Part1

I’ve seen something about Motor6D.C0 but I dont understand.

I dont really have alot of expirience in scripting but could you state what you mean? do you want the part1 to stand still while part0 is rotating?

This is what I want to achieve

This is what happens :

before :

after :
image

This is what I want to happen :

before :

after (but when moved, part1 follows.) :

You can do this easily with rig editors, but I want to do this from within a script

Im not familiar with motors and stuff but you could try this (not guaranteed to work)

local part2Position = Part2.Position

Part1.Position = part1Position
Part2.Position = part2Position```

oh yea keep the first script too

that doesn’t work, it automatically teleports itself back to the default motor6d position

oof. Sorry. if that didnt work then idk what else to do

You would do it like this

local m6d = Instance.new("Motor6D", Part0)
m6d.Enabled = false
m6d.Part0 = Part0
local pos, pos2 = Part0.Position, Part1.Position
m6d.Part1 = Part1
m6d.C0 = CFrame.new(pos2 - pos)
m6d.Enabled = true