So, I’m trying to make a pathfinding module and using Humanoid:ChangeState() causes the NPC to jump, even if it’s mid-air. I’ve tried doing Humanoid.Jump = true, but that causes the NPC to jump once, but never complete the other jumps and get stuck.
ChangeState Behavior:
Humanoid.Jump Behavior:
Code:
moveToFinished = self.Humanoid.MoveToFinished:Connect(function(wasReached: boolean)
if (not wasReached) or (nextWaypointIndex >= #pathWaypoints) then
self.StopPathfinding:Fire(true)
if nextWaypointIndex == #pathWaypoints then
return self.TargetReached:Fire()
end
return self.PathFailed:Fire()
end
nextWaypointIndex += 1
if pathWaypoints[nextWaypointIndex].Action == Enum.PathWaypointAction.Jump then
self.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
self.Humanoid:MoveTo(pathWaypoints[nextWaypointIndex].Position)
end)
Any idea how to fix this?