Animating Custom Enemy NPC

Hey all, I’m currently trying to script the animations I’ve created for an enemy NPC to play during their respective actions.

My question comes from how can I tell when my npc is not moving, moving, or jumping? I looked into HumanoidState but that doesn’t seem like it will accomplish what I need. Unless I’m using it wrong.

Every animation tutorial I look up just copy and pastes the default ROBLOX LocalScript Animator, which works for Player animations but not NPC animations. Maybe I could frankenstein the local script to work, but i’d rather try and learn the best way to go about this.

I would use the StateChanged (has two params: OldHumanoidStateType, NewHumanoidStateType) event within the Humanoid, and keep a dictionary of all the animations. Once the state has changed, pause all the old anims, and play the new one. Simple.

Could we see your current code?

1 Like