Can't change HumanoidStateType to Physics anymore

Hi developers,

I recently discovered that my ragdoll script, which used to work does not do its job now the way it was intended to.

Basically, my problem is that I cannot change the player’s HumanoidStateType to Physics at all. It just stays Enum.HumanoidStateType.Running.
Here’s a picture showing when the console prints that it has switched to ragdoll and what state the HumanoidStateType is in:
image

Here’s my code:

local uis = game:GetService("UserInputService")
local status = "unragdoll"
local originstatetype = game.Players.LocalPlayer.Character:WaitForChild("Humanoid").GetState(game.Players.LocalPlayer.Character:WaitForChild("Humanoid"))

print(originstatetype)

uis.InputBegan:Connect(function(inputobject)
	if inputobject.KeyCode == Enum.KeyCode.R then
		if status == "unragdoll" then
			status = "ragdoll"
			game.ReplicatedStorage.TestRagdoll:FireServer("Ragdoll", game.Players.LocalPlayer.Character)
			local hum = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
			
			--hum:SetStateEnabled(Enum.HumanoidStateType.Running, false)
			--hum:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics, false)
			--hum:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
			--hum:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)
			hum:ChangeState(Enum.HumanoidStateType.Physics)
			print("ragdoll;",hum:GetState())
		elseif status == "ragdoll" then
			status = "unragdoll"
			game.ReplicatedStorage.TestRagdoll:FireServer("Unragdoll", game.Players.LocalPlayer.Character)
			local hum = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")

			hum:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
			hum:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
			hum:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)
			hum:ChangeState(Enum.HumanoidStateType.Running)
			
		end
	end
end)

Thank you in advance for your replies! :slightly_smiling_face:

1 Like

what happens if you print hum:GetStateEnabled(Enum.HumanoidStateType.Physics)?

I edited my code a little bit to make it so Physics is enabled in the HumanoidStateType, and tried your idea and print out hum:GetStateEnabled(Enum.HumanoidStateType.Physics), but it still does not work.
image

Here are the new lines in my code in case you need it.

hum:SetStateEnabled(Enum.HumanoidStateType.Physics, true)
hum:ChangeState(Enum.HumanoidStateType.Physics)
print("ragdoll;",hum:GetState())
print(hum:GetStateEnabled(Enum.HumanoidStateType.Physics))

Did you ever find a fix for this? I am running into this exact same problem using a ragdoll too, even if I set the state to Physics every frame.