Humanoid NPC falling down when CFramed into a new position

I have been encountering this issue for a while and I can’t seem to find a solution anywhere. I have an NPC Humanoid which I had disabled all its States except for the Running State. And my NPC keeps falling down then getting back up when CFramed. I want it to never fall down.

However, I did test printing the State changed and obviously it never prints anything since there is only 1 State enabled, that is the Running State.

I have also tried enabling all States or disabling only a few of them but still this keeps on happening.

May I also add, that before giving the Humanoid NPC a new CFrame I am anchoring the HumanoidRootPart and unanchoring it again after it is CFramed.

What are your thoughts about this?

Demonstration:
Green = Unanchored HumanoidRootPart
Red = Anchored HumanoidRootPart

Added a copy here: (Give it a few attempts before it’ll start happening)
Humanoid tripping.rbxl (26.6 KB)

3 Likes

Leave the getting up state and have the humanoid jump and it should be fine (after the unanchoring).

Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
Humanoid.Jump = true

If it’s still tripping, maybe there’s something inside the figure that’s causing it to trip, check the collide properties inside it.

4 Likes

Set the state to “Freefall” when you spawn them in, and make sure it is enabled.

1 Like

Added a demonstration of what is happening as I figured out the problem is coming from the anchoring and unanchoring of the part.

Didn’t seem to have worked.

its not getting up in the demo

i don’t understand. do you want the character to get up or not

If you look at the gif, the dummy is falling down after changing its CFrame and unanchoring the PrimaryPart.

image

1 Like

and you want it to stay in the air? or stand when it falls?

I want it not to trip.

1 Like

Try Disabling HumanoidState

FallingDown

and

Ragdoll

with

SetStateEnabled

Humanoid:SetStateEnabled(0, false)
Humanoid:SetStateEnabled(1, false)
2 Likes

Nope

1 Like

I have added a copy of the file, for those that wish to check it out first hand.

1 Like

I think it’s caused by NetworkOwnership

Code
local dummy = workspace.Dummy
local active = workspace.Green
local inactive = workspace.Red

local count = 0

local humanoid = dummy.Humanoid
humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)

dummy.HumanoidRootPart:SetNetworkOwner(nil)

while true do
	
	count = count+1
	print(count)
	
	wait(1)
	
	dummy:SetPrimaryPartCFrame(active.CFrame)
	dummy.PrimaryPart.Anchored = false
	dummy.HumanoidRootPart:SetNetworkOwner(nil)
	
	wait(1)

	dummy.PrimaryPart.Anchored = true
	dummy:SetPrimaryPartCFrame(inactive.CFrame)
	
end

It didn’t trip after I added dummy.HumanoidRootPart:SetNetworkOwner(nil)


Humanoid tripping.rbxl (27.1 KB)

I also added some

Client Side Code
local humanoid = workspace.Dummy.Humanoid
humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)

and removed dummy.HumanoidRootPart:SetNetworkOwner(nil)

seems like it’s not tripping anymore


So basically, the tripping was caused by the Player rendering physics for the Dummy and humanoid:SetStateEnabled doesn’t replicate some how?

and to solve it you can either do Part:SetNetworkOwner(nil) or Humanoid:SetStateEnabled on the Client

4 Likes

They still tend to trip occasionally when they are first spawned but seems like they’re stable afterwards with this method. Thanks.

1 Like

Figured out I should avoid this method as it made my NPCs look as if they are in a different position on the client than they really are on the server.