Arguement 2 missing or nil?

I have been trying to make a (very basic) knock down system and i got argument 2 missing or nil, any idea how to fix this?

local knocked = script.Parent.Humanoid:GetAttribute("knocked_down")
while true do
	wait(0.25)
	if script.Parent.Humanoid.Health <= 10 then
		knocked = true
		script.Parent.Humanoid:SetStateEnabled("Ragdoll")
	else
		knocked = false
	end
	
end
1 Like

The error occurs on this line of code. You haven’t provided the second argument which determines if the state can be used or not. Add a second argument to that line of code as true or false.

script.Parent.Humanoid:SetStateEnabled("Ragdoll", true)

I also notice that you’re trying to enable a state that isn’t actually a state. It’s a string. Consider using Enums.

script.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.validnamehere, true)

There no HumanoidStateType such as “Ragdoll”, so your script will probably error cause of that. Check out this documentation, that lists all the HumanoidStateTypes available: HumanoidStateType | Roblox Creator Documentation

1 Like

Thanks, i was so confused lol
(P.S there is a state called “Ragdoll”, its the one where you have no animations and you’re on the floor :))

1 Like

Weird… Just checked, it’s indeed a valid humanoid state. It isn’t listed on the page though.

1 Like

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