How do HumanoidStates work for NPCs?

While doing testing for adding AI to my game, I found that setting their humanoidstate on the server would not work for me, how would I make them enter the ragdoll state?

For reference: Hitting the player knocks them down as shown in the clip below, where as hitting the AI applies the velocity without knocking him over.

What about just setting Humanoid.PlatformStand to true?

1 Like

I’ve done this in the past, but nothing is better than Ragdoll state. If you set the PlatformStand to true then it works at the beginning, but getting up causes many bugs and it flings the players/AI at times.

When using :ChangeState method, you must call it from client. (Im not sure, correct me if Im wrong.)

I would suggest using remote event.

I know that is the case for other players, but what if I wanted to do this on an NPC? Would I have to to call this from the client on NPCs too? If so wouldn’t that be highly exploitable?

1 Like

The developer hub does say this, but I’m not sure how it applies to NPCs.

It seems that ChangeState does not work on NPCs, since a NPC does not have a client that you can set the HumanoidStateType from.

I definitely agree that fix of some sort should be made, if a workaround doesn’t exist.

1 Like

@rifqizahin_devforum is technically right, but it’s still highly exploitable. I feel this should be changed in some shape or form, but I can do hits normally on the AI if I set his HumanoidState on the client hitting it.

1 Like

I don’t think it’s working with NPC, I already test it.

I think changestate method doesn’t work with NPC.

So I think you should use bodyposition / bodygyro.

(note: humanoid doesn’t die when change state called to death.)

I was testing with this for a second, however, it only works if I set the states on both the client AND the server, why is this? I’ve 0 clue, interesting.