HumanoidRootPart is anchored, even though it's not

I’m having a really weird issue, where the HumanoidRootPart of an NPC won’t unanchor, but print says it is set to false…

Im trying to make a mechanic where if the NPC dies, the root part is anchored (so the body doesnt get flinged around), an animation is played, the root part is unanchored and then the character ragdolls.
It all works perfectly, except for the unanchoring part. the root part just refuses to unanchor, but trying to print the state of it says its false.

humanoid.Died:Connect(function()
	if script.Parent:FindFirstChild("Head") then
		char.HumanoidRootPart.Anchored = true
		DeathAnim1:Play()
		wait(1)
		humanoid.PlatformStand = true
		char.HumanoidRootPart.Anchored = false
		Ragdoll()
	else
		char.HumanoidRootPart.Anchored = true
		decapitation:Play()
		wait(1)
		char.HumanoidRootPart.Anchored = false
		print(char.HumanoidRootPart.Anchored)
		Ragdoll()
	end
end)

this is the block of code. (it also detects whether the character has a head, for a different animation but that shouldnt cause the issue)

I have a theory as to why this happens, being that this function is called a bunch of times when the char dies because the anchored state is printed various times, and it only prints when its unanchored, (however the root part is visibly always anchored, and checking the browser while playing always shows its anchored) but I got no clue how i’d stop that from happening. any help is appreciated

_

Can i see the code inside “ragdoll()” function?

local function Ragdoll()
	char.HumanoidRootPart.Anchored = false
	humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
	humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
	for _, v in pairs(char:GetDescendants()) do
		if v:IsA("Motor6D") then
			local Att0, Att1 = Instance.new("Attachment"), Instance.new("Attachment")
			Att0.CFrame = v.C0
			Att1.CFrame = v.C1
			Att0.Parent = v.Part0
			Att0.Name = "Att0"
			Att1.Name = "Att1"
			Att1.Parent = v.Part1
			local BSC = Instance.new("BallSocketConstraint")
			BSC.Attachment0 = Att0
			BSC.Attachment1 = Att1
			BSC.Parent = v.Part0
			BSC.LimitsEnabled = true
			BSC.MaxFrictionTorque = 50
			BSC.TwistLimitsEnabled = true
			BSC.UpperAngle = 90
			BSC.TwistLowerAngle = -90
			BSC.TwistUpperAngle = 90
			BSC.Name = "BSC"
			v.Enabled = false
		end
	end
end

I didnt make this, so I’m not 100% sure of what it does but I dont think it should cause issues

Does the ragdoll function work perfectly on the NPC? ( Without anchor and unanchor the humanoidrootpart)

Yeah, but without anchoring the root part the character bounces around cause of the animation

Can you tell me is the script a localscript or server script? Are you checking the npc humanoidrootpart anchored state on server explorer or client explorer?

its a server script in the NPC model. I’m not sure how to know which explorer I was using, but I’m assuming its whats on the “Current” thing on the Test tab, and both were anchored