Carrying / How to properly weld characters

Hello, guys. I’m working on a knock/carry/execute system, so basically when player’s health get lowered to zero, he gets knocked and someone can pick them up or finish. I’m using Echo Reaper’s Ragdoll Module in the knocked state, and when carrying a player, I’m turning it off and try to weld their humanoid root parts, but eventually they both end up dying. How do I properly weld them and prevent death?

CharacterEvents.Carry.OnServerEvent:Connect(function(PlayerWhoCasted)
	local EnemyCharacter = PlayerWhoCasted.Character

	if not IsCharacter(EnemyCharacter) then
		return
	end

	local EnemyRootPart = EnemyCharacter:FindFirstChild("HumanoidRootPart")
	local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")

	if PlayerWhoCasted ~= Player and StatusManager:Has(Character,"Knocked") and not StatusManager:Has(Character,"Carried") and not StatusManager:Has(EnemyCharacter,"Carried","Stunned","Knocked") then
		Ragdoller:Set(Humanoid,false)
		
		for i,v in pairs(Character:GetDescendants()) do
			if v:IsA("BasePart") and v.CanCollide == true then
				v.CanCollide = false
				table.insert(PartsToRestore,v)
			end
		end

		local PrimaryWeld = Instance.new("Weld",EnemyRootPart)
		PrimaryWeld.Name = "CarryWeld"
		PrimaryWeld.Part0 = EnemyRootPart
		PrimaryWeld.Part1 = HumanoidRootPart
		PrimaryWeld.C0 = CFrame.new(0,6,0)

		PrimaryWeld.Destroying:Connect(function()
			for i,v in pairs(PartsToRestore) do
				v.CanCollide = true
			end
			Ragdoller:Set(Humanoid,true)
			StatusManager:Create(Character,"Knocked")
			StatusManager:Remove(Character,"Carried")
		end)
	end
end)

Found the solution: I really messed up. Code works, however if I weld a dead character to an alive they both die.

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