Motor6D not working for attaching armor to player

Hello everyone, I am trying to attach some armor to the player. My Motor6D script is as follows (I tried using welds earlier but it had the same problem as motor6D, currently)

if string.match(Craftable.Name,"Armor") then
		local craft = Craftable:Clone()
		
		craft.Parent = Player.Character
		local weld = Instance.new("Motor6D")
		weld.Parent = Player.Character.HumanoidRootPart
		local armor = craft
		armor.Parent = Player.Character
		weld.Part0 = Player.Character.HumanoidRootPart
		weld.Part1 = armor
		armor.CFrame = Player.Character.HumanoidRootPart.CFrame
		armor.Orientation = Vector3.new(armor.Orientation.X,armor.Orientation.Y + 90,armor.Orientation.Z)

robloxapp-20220821-1355062.wmv (810.0 KB)
In the video, the armor follows the torso, but it’s orientation never changes, but the torso’s orientation does (when the player is walking)

Try using CFrame.fromEulerAnglesXYZ. Keep in mind you can also use CFrame.new(Posiiton, LookAt) to create a CFrame at Position looking at LookAt.

The part where the armor spawns is fine. Also, it’s just torso armor, so can’t motor6d make the armor follow the torso?

Motor6D is a valid JointInstance, meaning it is similar to Weld. This in return makes the joint unable to move based upon Orientation (some cases may vary), but from my experience joints don’t seem to move based on their connected part’s orientation. You’ll have to use the C0, C1 or Transform property of your Motor6D.

Sorry, I’m not familiar with joints/welds. How could I use the C0, C1, or transform property?

Thank you!

C0 & C1 are primarily used for moving joints, the best example of these being used is animating rigs without the need for AnimationTrack although it does need some heavy mathematical knowledge.

Transform is a property used by AnimationTrack to animate a character.

Would it work to just do

while true do
	armor.CFrame = Player.Character.HumanoidRootPart.CFrame
	armor.Orientation = Vector3.new(armor.Orientation.X,armor.Orientation.Y+90,armor.Orientation.Z)
	wait()
end
?

Technically, yes. Unfortunately, this wouldn’t be trivial, as welding is the best way for both the client & the server to understand where the armor is supposed to be.

I just tried it, it doesn’t work. Do you know any tutorials on attaching armor to the player?

Here’s an example of attaching a part to another.

local motor6d = Instance.new("Motor6D")
motor6d.Part0 = player.Character.HumanoidRootPart
motor6d.Part1 = armor
motor6d.C0 = CFrame.fromEulerAngles(0, math.rad(90), 0)
motor6d.Parent = motor6d.Part0

With the script

local craft = Craftable:Clone()
		
		craft.Parent = Player.Character
		
		local armor = craft
		local motor6d = Instance.new("Motor6D")
		motor6d.Part0 = Player.Character.HumanoidRootPart
		motor6d.Part1 = armor
		motor6d.C0 = CFrame.fromEulerAngles(0, math.rad(90), 0)
		motor6d.Parent = motor6d.Part0

It still has the same problem where the orientation doesn’t change…

It worked after I set it’s part 0 from HumanoidRootPart to UpperTorso…

1 Like