Why can't I make my character crouch?

Here is my functions and the playerinputcomponent

 void AHero::StartCrouch()
    {
    	Crouch();
    }

void AHero::StopCrouch()
{
	UnCrouch();
}

	// Sets up "crouch' binding
	PlayerInputComponent->BindAction("Crouch", IE_Pressed, this, &AHero::StartCrouch);
	PlayerInputComponent->BindAction("Crouch", IE_Released, this, &AHero::StopCrouch);

Below is my .h file declarations

	// Handles the "crouch" binding
	UFUNCTION()
	void StartCrouch();

	UFUNCTION()
	void StopCrouch();

I don’t know why it isn’t working to be honest. Any solutions?

Put this in the constructor: GetCharacterMovement()->NavAgentProps.bCanCrouch = true;

and on StartCrouch function make sure you call the Crouch(); function.

Thanks! It works!

But is there anyway I can make the crouch button toggle-able? Meaning can I press the button and not need to hold the button to keep crouching?

Sure. To do that, you have to call this code in the event when the Crouch button is pressed:

GetCharacterMovement()->IsCrouching() ? UnCrouch() : Crouch();