Rotating bug with Welds and NPCS

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I’m working on a system that allows the player to pick up and throw NPCS that are rendered unconscious by my system. I create the NPC’s with a table and have a Body property that holds the NPC’S physical body. This is what that looks like.

function NPC_HANDLER:newNPC(SpawnPoint:CFrame,Variant,Parent)
	local Model = game.ReplicatedStorage.NPCS.Patient
	local NPC_ID = tostring(math.random(1,999999999))
	
	NPC_Table[NPC_ID]= {
		Blood = {},
		Body = Model:Clone(),
		SpawnLocation = SpawnPoint,
		Parent = Parent,
		KnockOut = function()
			NPC_Table[NPC_ID].Body:SetAttribute("Unconscious",true)
			print("Knocked Out")
		end,
		WakeUp = function()
			NPC_Table[NPC_ID].Body:SetAttribute("Unconscious",false)
		end,
		RemoveFactor = function(FactorName)
			NPC_Table[NPC_ID].Blood[FactorName] = nil
		end,
	}
	spawnNPC(NPC_ID)
	return NPC_Table[NPC_ID]
end
if closestChar:GetAttribute("Unconscious") then
	closestChar.IsRagdoll.Value = false
end
					for _, v in closestChar:GetDescendants() do
						if v:IsA("BasePart") then
							v.CollisionGroup = "Carry"
						end
					end
					AnimationHandler:PlayAnimation(closestChar, animFolder.Carried)
					AnimationHandler:PlayAnimation(Character, animFolder.Carrying)

					closestChar.HumanoidRootPart.CFrame = HRP.CFrame * CFrame.new(0, 3, 0)
					Character:SetAttribute("Carrying", closestChar:GetAttribute("ID"))
					closestChar:SetAttribute("CarriedBy", Player.UserId)

					local weld = Instance.new("WeldConstraint")
					weld.Parent = HRP
					weld.Part0 = HRP
					weld.Part1 = closestChar.HumanoidRootPart
					weld.Name = "CarryWeld"

(Keep in mind that ragdoll doesnt do anything right now)

  1. What is the issue? Include screenshots / videos if possible!

The problem is that for some reason, when welding the NPC to the character, it becomes buggy. Instead of rotating normally, when holding the NPC, the characters rotation is delayed. (the NPC on the left was loaded 2 seconds after the first)

The strange part is that the only fix is to spawn the NPC right after the game starts. I trimmed it down to this line of code.

Body = Model:Clone()

It seems that something happens to the model in replicated storage but Im not sure what that could be. I isolated this script so nothing is touching the NPC’S (so its not a race condition thing).

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I looked on reddit, devForum, youtube, and I couldnt find anything. I changed the model that it references. I tried every type of weld. I changed a bunch of different Humanoid states like physics, seated, platform stand. Nothing changes the result.

I went to sleep at 6 in the morning today still struggling to figure out what was wrong, and I finally found out. I wasn’t expecting to fix this on my own but I got it. If you ever have this problem, heres the solution:

--On Activation
for _, v in model:GetDescendants() do
	if v:IsA("BasePart") then
		v.Massless = true
	end
end
--On Release
for _, v in model:GetDescendants() do
	if v:IsA("BasePart") then
		v.Massless = false
	end
end

I previously tried this but with GetChildren() instead, and as it turns out you cannot have ANY mass in your model. My theory is that if you instantly clone the model from replicated storage, it doesn’t have any time to register any of the physics properties correctly or fully. I wasnt aware that additional mass from welds also affects angular drag along with velocity. Keep this in mind for future projects so you dont have to go crazy like i did for 9 hours trying to figure it out.