Humanoid State Disabling Bug

  1. What do you want to achieve? The code to work.

  2. What is the issue? When I iterate over every HumanoidStateType using Enum.HumanoidStateType:GetEnumItems(), and then setting is to be not enabled in Humanoid, I get this error: Invalid state passed to SetStateEnabled. Although when passing the Enum directly, manually, it worked.

  3. What solutions have you tried so far? None.

Heres my script:

for _, state in Enum.HumanoidStateType:GetEnumItems() do
	if state == Enum.HumanoidStateType.Dead then continue end

	turretModel.Humanoid:SetStateEnabled(state, false)