Ok i finnaly did it 
First of all i use c++ instead of BP like:
Header:
#include "GameFramework/CharacterMovementComponent.h"
//..other code
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "animation")
bool eSeduto; //is crouch
//other code
private:
void isCrouch();
CPP:
// Called to bind functionality to input
void APrincipalePersonaggio::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
//... other inputs
PlayerInputComponent->BindAction(TEXT("toggleCrouch"), EInputEvent::IE_Pressed, this, &APrincipalePersonaggio::isCrouch);
}
void APrincipalePersonaggio::isCrouch()
{
if (GetCharacterMovement()->IsCrouching())
{
UnCrouch();
eSeduto = false;
}
else
{
Crouch();
GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true;
eSeduto = true;
}
}
In BP:
Hoping it will be useful to someone I wish you a good day 