Problems with Enum.HumanoidStateType.Ragdoll

Hello, I’m pretty new with “Enum.HumanoidStateType” and im not sure why this isnt working.
I’m trying to make a system where you fall off a certain height you ragdoll, a sound plays and you take damage. But the problem is with the ragdolling
heres the script:

damageHeight = 6
local char = script.Parent
local root = char:WaitForChild("HumanoidRootPart")
local humanoid = char:WaitForChild("Humanoid")

if humanoid and root then
	local headHeight
	local ragdollActivated = false

	humanoid.FreeFalling:Connect(function(state)
		if state then
			headHeight = root.Position.Y
		elseif not state and headHeight ~= nil then
			local fallDistance = headHeight - root.Position.Y

			if fallDistance >= damageHeight and not ragdollActivated then
				ragdollActivated = true
				humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll) -- why no work
				
				humanoid.Health = humanoid.Health - math.random(5,10)
				local soundClone = script.Sound:Clone()
				soundClone.Parent = char.Head
				soundClone.Playing = true
				wait(2) 

				ragdollActivated = false
				humanoid:ChangeState(Enum.HumanoidStateType.Physics)
			end
		end
	end)
end

I’m trying to set the Enum.HumanoidStateType to “Ragdoll”
why isnt this working help needed

this isn’t solved yet, please help

stopped using Enum.HumanoidStateType now solved

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