I am trying to weld two players Humanoid Root Parts but have a strange bug

I am trying to make a carry system for downed players but don’t want to have to duplicate the character.

Whenever I weld the player’s Humanoid Root Parts together the one with full health can not move unless the they are moving when the weld is created,

I’ve tried experimenting with hip height, it doesn’t have to do with mass, anchoring as far as I’m concerned

My code is relatively janky but I don’t think it has anything to do with the bug,

game.Players.PlayerAdded:Connect(function(plrr)
	plrr.CharacterAdded:Connect(function(character)
		local statfol = Instance.new("Folder",character)
		statfol.Name = "Stats"
		local carried = Instance.new("BoolValue",statfol)
		carried.Name = "Carried"
		local carrying = Instance.new("BoolValue",statfol)
		carrying.Name = "Carrying"
		--
		carried.Value = false
		carrying.Value = false
		--
		wait(1)
		character.Parent = game.Workspace.Characters
		character.Humanoid.Died:Connect(function()
			carried.Value = false
			carrying.Value = false
		end)
	end)
end)
local closestplayer = nil
game.ReplicatedStorage.RemoteEvents.LocalToServer.CarryInput.OnServerEvent:Connect(function(player)
	local carrying = workspace.Characters:WaitForChild(player.Name):WaitForChild("Stats"):WaitForChild("Carrying")
	if carrying.Value == true then
		carrying.Value = false
	else 
		carrying.Value = true
	end
	local character = nil
	local closestDistance = math.huge
	local players = game.Players:GetChildren()
	local plrhum = game.Workspace.Characters:WaitForChild(player.Name).HumanoidRootPart
	for i=1, #players do
		local Character = workspace.Characters:GetChildren()[i]
		if plrhum.Parent ~= Character then
			if Character:WaitForChild("Stats"):WaitForChild("Carried").Value == false then
				if (Character.HumanoidRootPart.Position - plrhum.Position).Magnitude < closestDistance then
					closestDistance = (Character.PrimaryPart.Position - plrhum.Position).Magnitude
					character = Character
				end
			end
		end
	end
	local weld = Instance.new("Weld")
	local track1
	local track2
	if closestDistance < 11 then
		character.HumanoidRootPart.Anchored = false	
		weld.Parent = plrhum
		weld.Part0 = plrhum
		weld.Part1 = character.HumanoidRootPart
		weld.C1 += Vector3.new(0,-0.25,0)
		character.HumanoidRootPart.Massless = true
		track1 = character.Humanoid:LoadAnimation(script.Carried)
		track1:Play()
		track2 = plrhum.Parent.Humanoid:LoadAnimation(script.Carry)
		track2:Play()
		repeat wait(0.2)until carrying.Value == false
		character.HumanoidRootPart.Massless = false
		weld:Destroy()
		track1:Stop()
		track2:Stop()
	end
end)

Has anyone ever had experience with this sort of thing and knows a solution?
(I really don’t want to resort to duplicating the character)
I’ve also noticed the player that is carrying the other is being forced slightly into the ground as if there is some sort of force pushing them down

1 Like

Would disabling their movement after the weld work for you?

I’m not sure it works, I just tried

I believe this is an issue with NetworkOwnership. By default clients have complete control over their own physics which is making strange unreplicated behaviors. Even if you disable movement it won’t fix the desyncing. Use a server script to change the network ownership of one of the players to the other player so that the physics will sync across clients.

Thank you, I think this might work but I’ll have to test it out first, I will do more research next time because I have never heard of how network ownership works.

1 Like

Should I be getting network ownership of the primary part

All parts in the model should be set to the other player. Just make sure that when the player is “put down” their network ownership is set back to them.

1 Like

I am not sure it works, sorry.

How exactly are you implementing it?

for i,part in pairs(character:GetChildren()) do
	if part:IsA("BasePart") then
		part:SetNetworkOwner(game.Players:WaitForChild(*this is the player*))
	end
end

As for the movement issue I cannot be certain and don’t know the full cause in this context. For the “pushing down” issue, it may be because you are only setting massless to the HRP and not the other parts of the character such as the torso and head.

I tried to make it massless and that helps a bit, but around 5 seconds later you cannot walk again and you seem to be pushed down

Welding anything to the player that has both a Humanoid and a part name HumanoidRootPart inside it seem to cause strange bugs when walking for me too. Massless and CanCollide seem to suddenly be not respected randomly or never.

For now, I work around it by changing the name of HumanoidRootPart temporarily while carrying it. Animations still work, however, doing this causes subsequent Humanoid functions such as Humanoid:MoveTo to not work. A hacky way I found to get these to work again is setting Humanoid.RigType to Enum.HumanoidRigType.R15 and back again to Enum.HumanoidRigType.R6.


Code looks something like this:

local hrp = script.Parent.HumanoidRootPart

function makeCharacterCarryMe(character)
	local leftHand = character:FindFirstChild("LeftHand")
	local leftGripAttachment = leftHand:FindFirstChild("LeftGripAttachment")

	hrp.Name = "_HumanoidRootPart" -- Causes Humanoid built-ins like auto-upright to disable
	hrp.CanCollide = false
	hrp.CarryRigidConstraint.Attachment1 = leftGripAttachment
end

function dropMe()
	hrp.CanCollide = true
	hrp.CarryRigidConstraint.Attachment1 = nil
	
	hrp.Name = "HumanoidRootPart"
	me.Humanoid.RigType = Enum.HumanoidRigType.R15 -- Causes HumanoidRootPart to be detected again
	me.Humanoid.RigType = Enum.HumanoidRigType.R6
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.