How to character dash only when its moving

I just started learning ue4 and I learned the dash mechanic from a youtube tutorial. However there is something I would like to change, how to make it so the the character can only dash when its moving and not when its standing still?
Attached below is the code snippet:

void AMyProjectCharacter::Dashing()
{
	const FVector ForwardDir = this->GetActorRotation().Vector();
	LaunchCharacter(ForwardDir * DashDistance * DashSpeed, true, true);
	
}

Sidenote, the youtube tutorial only calculated the speed travelled but I would also like to separate it to the speed and distance travelled. I just multiplied it as above but is there a proper to calculate the distance and speed?

I suggest checking that the character’s velocity is above a certain threshold to allow dashing, or if it suits better, checking an input is held down.

I don’t know quite what you’re asking for in your second question

Thanks for replying, but how do I check the character velocity? I tried to make an if statement, but I do not know how to call it, I tried an if (GetActorForwardVector.Value != 0), but its showing me an error

You could try this:

if(GetCharacterMovement()->Velocity != FVector::ZeroVector){
  ...
}

There is also a method:

GetCharacterMovement()->IsMovementInProgress()

But I’ve never used it, so I’d assume it is false if the Velocity is zero. You’d have to test it to be sure.

This did it for me, thank you so much