I found an interesting thing while using ChangeState(), and I’m not sure of it’s a bug or a feature. If this is the wrong category and should be reported as a bug, please let me know.
Anyways, NPCs in my game play a noise when they die. They also have a script in them for pathfinding. If their path is blocked, one of their options is to jump to get over the obstacle, using
Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
The interesting thing is, if the NPC is dead, the pathfinding still runs until they’re removed (a small oversight on my part). If it determines they need to jump, it makes plays the death sound again.
So my question is, what is ChangeState doing? Since playing the death sound is connected to a Humanoid.Died function, does it make the game think the NPC is alive again? Is this a bug, or is this supposed to happen?