I'm currently making a ragdoll system, and in order for the character parts collide with other blocks, character's HumanoidStateType must be set to Enum.HumanoidStateType.Ragdoll. Disabling all other humanoidstatetype's or changing HumanoidStateType to Enum.HumanoidStateType.Ragdoll doesn't work.

Here's the script:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(Character)
		for i = 1, #Enum.HumanoidStateType:GetEnumItems() - 1 do
			local CurrentEnum = Enum.HumanoidStateType:GetEnumItems()[i]
			if CurrentEnum ~= Enum.HumanoidStateType.Ragdoll then
				Character.Humanoid:SetStateEnabled(CurrentEnum, false)
				print(tostring(CurrentEnum).." is disabled")
			else
				print(tostring(CurrentEnum).." is enabled")
			end
		end
		
		-- checking if changing the state changes anything
		print(Character.Humanoid:GetState()) -- Enum.HumanoidStateType.None
		Character.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
		print(Character.Humanoid:GetState()) -- Enum.HumanoidStateType.None
		
		-- checking if ragdoll is enabled and running is disabled
		print(Character.Humanoid:GetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics)) -- false
		print(Character.Humanoid:GetStateEnabled(Enum.HumanoidStateType.Ragdoll))          -- true
	end)
end)

Script is in ServerScriptService. No errors occur.

Basiclly, it prints all enabled and disabled state types.

1 comment

0

HumanoidStateType can only be changed on client.