Cannot weld part to humanoidrootpart exactly

For whatever reason, I cannot weld this part to the player’s humanoidrootpart so that it’s in the exact same spot as the humanoidrootpart

image

here is the code snippet for welding:

                        local torso			= Instance.new("Part")	--Fake Torso Part
			torso.Parent 			= self.char.character
			torso.Name			= "TorsoPart"
			torso.Anchored	  	        = false
			torso.CanCollide		= false
			torso.Material			= Enum.Material.SmoothPlastic
			torso.Transparency		= 0.5
			torso.Size 			= Vector3.new(2, 2, 1)
			
			local torsoweld			= Instance.new("Weld")
			torsoweld.Parent		= torso
			torsoweld.Name		= "TorsoPartWeld"
			torsoweld.Part0		= self.char.humanoidrootpart
			torsoweld.Part1		= torso
			
			torsoweld.C0			= CFrame.new(0, 0, 0)* CFrame.Angles(0, math.rad(0), 0)

It seems crazy simple, but I cannot get it to work. The “TorsoPart” that is being welded to the humanoidrootpart is slightly above the humanoidrootpart once it’s welded…

2 Likes

The HumanoidRootPart doesn’t move with animations. When your character has their knees bent and their feet are level with the ground, the torso will be below the top of the HumanoidRootPart. Maybe that’s what you’re seeing?

Try printing the position of the HumanoidRootPart and the position of the torso you’re welding just to make sure.

1 Like

image

Same X and Z position, but not Y position.

1 Like

How much is the difference, exactly?

it’s about 0.1 studs… But if I change the weld properties, the humanoidrootpart sometimes goes under the entire character, making the character appear as if it’s floating…

1 Like

torsoweld.C0 = CFrame.new(0, 0.1, 0)

I remember the Parent of the weld needing to be the same is its Part0. Can you parent it to self.char.humanoidrootpart instead?

1 Like

yeah, I wouldn’t mind :slight_smile:

image

The weld’s parent is Part0 which is the self.char.humanoidrootpart

And it’s still off

edit**

I forgot to tell you guys that I welded stuff to the TorsoPart, but I don’t understand why that would affect this… I disabled the other welds, and it now works… I guess I have to look at my other welds for the arms, head, etc…

1 Like

Thanks @XAXA for trying to help me. I eventually figured it out, but I gave you the “solution” because you told me to change a weld property - which gave me an idea that solved my problem :slight_smile:

Post what you did to fix your problem anyway and mark your own reply as the solution :upside_down_face:

1 Like

Within my welding setup, that I posted in the original post, I left out some parts, including this:

--head weld
			local headweld			= Instance.new("Weld")
			headweld.Parent			= humanoidrootpart
			headweld.Name			= "HeadWeld"
			headweld.Part0			= self.char.uppertorso --Part0 used to be torso
			headweld.Part1			= self.char.head
			headweld.C0				= CFrame.new(0, 1, 0)
			headweld.C1				= CFrame.new(0, -0.5, 0)-- * CFrame.Angles(math.rad(30), 0, 0)

For whatever reason, the “head weld” ruined my character welding, but I fixed it by switching the Part0 to the upper torso part… (I now need to re-calculate the C0, C1 offset for the head weld, but that isn’t much of a problem)

1 Like

image

Edit****

Just fixed the problem again… (I think it was unsolved before this v)

When the player spawns, I tried to teleport their character by changing the humanoidrootpart position instead of the CFrame, and I think that’s what caused the humanoidrootpart to go underneath the character. After analyzing 2000 lines of code for 4 hours, that’s what caused the problem.

The reason why this wasn’t a quick fix was because there was no syntax errors, I thought it might’ve been a logic error within one of my animation functions, and I didn’t think for a second that teleporting the character using position instead of CFrame would ruin it.

1 Like