ChangeState() wont work for some reason

My ragdoll script has been running into a problem. Whenever the ragdoll bool is true, everything else works except the line where it changes the state to Physics. I don’t see how this would not work and I am genuinely confused.

Code:

local RagdolledBool = script.Parent.Ragdolled

RagdolledBool:GetPropertyChangedSignal("Value"):Connect(function()
	if RagdolledBool.Value == true then
		script.Parent.Torso.Neck.Enabled = false
		script.Parent.Torso["Left Shoulder"].Enabled = false
		script.Parent.Torso["Right Shoulder"].Enabled = false
		script.Parent.Torso["Left Hip"].Enabled = false
		script.Parent.Torso["Right Hip"].Enabled = false

		local HRPWeld = Instance.new("WeldConstraint")
		HRPWeld.Name = "HRPWeldCon"
		HRPWeld.Part0 = script.Parent.Torso
		HRPWeld.Part1 = script.Parent.HumanoidRootPart
		HRPWeld.Parent = script.Parent

		script.Parent.HumanoidRootPart.RootJoint.Enabled = false
		
		script.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
	else
		script.Parent.Torso.Neck.Enabled = true
		script.Parent.Torso["Left Shoulder"].Enabled = true
		script.Parent.Torso["Right Shoulder"].Enabled = true
		script.Parent.Torso["Left Hip"].Enabled = true
		script.Parent.Torso["Right Hip"].Enabled = true

		script.Parent.HRPWeldCon:Destroy()

		script.Parent.HumanoidRootPart.RootJoint.Enabled = true
		
		script.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	end
end)

Try using Humanoid:SetStateEnabled Humanoid:SetStateEnabled

Humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics,true)

doesn’t work sadly. thanks for the tip tho.

Ironically, Humanoid:SetStateEnabled() doesn’t work for me, but Humanoid:ChangeState() does.

Make sure your script is a Local Script.

--Example Inside of StarterCharacterScripts
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

task.wait(1)
Humanoid:ChangeState(Enum.HumanoidStateType.Physics)