Welding custom tool to character using Motor6D not working?

Hello all, hope you’re having a good day. I’m working on a custom weapons system, and am trying to get a sword model to weld correctly to a character’s right arm (there is an attachment called SwordEquip in the right arm to give the correct positioning).

However, I’ve run into an issue: the sword just doesn’t position itself correctly. I’ve looked on the forums for a while, and even asked ChatGPT, but nothing seems to work correctly.

Wanted result

vs

Current result

Yeah. If you couldn’t tell, I’m completely lost :sweat_smile:. Code is below:

weapon:PivotTo(arm.SwordEquip.WorldCFrame)
local o = weapon.Handle.Orientation
local weld = Instance.new("Motor6D",arm)
weld.Name = "Handle"
weld.Part0 = arm
weld.Part1 = weapon.Handle
weld.MaxVelocity = 0.1
weld.C1 = arm.SwordEquip.CFrame:inverse() * weapon:GetPivot() * CFrame.Angles(math.rad(o.X),math.rad(o.Y),math.rad(o.Z))*CFrame.new(0,-1,0)--goofy code

Any help on understanding what I’m doing wrong and how to fix this issue would be greatly appreciated!

1 Like

Maybe you should do my step

  1. Insert object Motor6D to weapon handle
  2. Attach Part0 to arm and Part1 to weapon handle
  3. Make sure you have change Weapon position correct by change C1 or C0 Position and Orientation
  4. After you finished changed where weapon attached next Unattach Part0 ( because you only just need configure weapon position )
  5. Replace your current script
    weapon.Handle.Motor6D.Part0=arm
1 Like

I did find a solution, which had me creating a part attached to the correct position on the character’s arms and then manualwelding the weapon handle to the part, so that the animations still work but that the weapon is attached. I was just wondering if there was a more “elegant” solution?

1 Like

I can say weapon can be animated.

about second way actually easy attach its
I use this plugin to weld easy but you insert motor6d then copy weld cframe to motor6d cframe

Well, that’s not what I’m looking for. The weapon is instantiated before animation, so I can’t just use moon animator’s easy weld. I need to fabricate a Motor6D so the weapon can be attached to the player upon creation, and this needs to happen automatically.