MoveToActor always fail

I’m trying to do a simple script in c++ to move an ai to the current player position. I created the blackboard, behavour tree, placed the navmesh and programmed the tasks. When i run the game, the ai didn’t move at all. I checked the actor and he is registered in the blackboard at runtime, i logged the result of MoveActor and it will give me always a failure state. Here’s the code

UBTTask_MoveToPlayer::UBTTask_MoveToPlayer()
{

}

EBTNodeResult::Type UBTTask_MoveToPlayer::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{

AAIControllerExampleEnemy *myAIController = Cast<AAIControllerExampleEnemy>(OwnerComp.GetAIOwner());
APlayerCharacter *PChar = Cast<APlayerCharacter>(OwnerComp.GetBlackboardComponent()->GetValueAsObject(myAIController->EnemyKeyID));

if (myAIController && PChar)
{
    GEngine->AddOnScreenDebugMessage(1, 5, FColor::Red, PChar->GetActorLocation().ToString());
    EPathFollowingRequestResult::Type P = myAIController->MoveToActor(PChar, 5.0f, true, true, true, 0, true);
    if (EPathFollowingRequestResult::Failed == P)
        GEngine->AddOnScreenDebugMessage(1, 1, FColor::Red, "fail");
    return EBTNodeResult::Succeeded;
}

return EBTNodeResult::Failed;
}

Its you if statement that is wrong, you only return succeeded if it fails.

if (EPathFollowingRequestResult::Failed == P)
GEngine->AddOnScreenDebugMessage(1, 1, FColor::Red, “fail”);
return EBTNodeResult::Succeeded;
}

// Griftenatt