I am trying to connect a weapon to the player’s right arm using Motor6D so I can animate the weapon.
However, when I do this, the joint gets created with the proper Part0, Part1 and parent, but the weapon moves undesirably.
Here is a video showcasing the issue:
As you can see, the weapon behaves very strangely. When the player is idle, the weapon moves far away and back to the hand repeatedly. With humanoid states like running and jumping, the weapon goes flying all over the place.
Here is what the idle animation is supposed to look like:
In the video you can see that the weapon is in the hand properly and not floating into the ground like it does in-game.
Here is also the script that connects the weapon to the player’s right arm:
local SS = game.ServerStorage local classArsenals = SS.ClassArsenals local used = false part.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and not used then used = true local character = hit.Parent local rightArm = character.RightArm local warriorArsenal = classArsenals.WarriorArsenal:Clone() local weapon = warriorArsenal.Weapon.Plastic local weaponJoint = Instance.new("Motor6D") weapon.CFrame = rightArm.CFrame * CFrame.new(0, -1.1, -1.35) weaponJoint.Part0 = rightArm weaponJoint.Part1 = weapon weaponJoint.C0 = rightArm.CFrame:Inverse() weaponJoint.C1 = weapon.CFrame:Inverse() weaponJoint.Parent = rightArm warriorArsenal.Parent = character end end)
Something I have noticed is that when I take out the parts of the code involving setting the CFrame, C0 and C1 of the weapon and joint, the weapon works correctly in the animations. Of course without setting the CFrames though, the weapon is not positioned correctly and ends up in the middle of the player’s arm. This leads me to believe the problem is with the CFrames, but I cannot figure out how to fix it.
If you have any ideas on how I could fix this, do not hesitate to let me know!