# Won't enter if statement for sprint

**URL:** <https://forums.unrealengine.com/t/wont-enter-if-statement-for-sprint/457832>\
**Category:** Character & Animation\
**Tags:** sprint, unreal-engine, CPP, question\
**Created:** [October 31, 2019, 3:20pm UTC](https://forums.unrealengine.com/t/wont-enter-if-statement-for-sprint/457832 "2019-10-31T15:20:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Endersky1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Endersky1](https://forums.unrealengine.com/u/Endersky1)\
**Post date:** [October 31, 2019, 3:20pm UTC](https://forums.unrealengine.com/t/wont-enter-if-statement-for-sprint/457832/1 "2019-10-31T15:20:40Z")

</div>

I am trying to make a sprint function and I want to check to see if he’s going faster before I start any of the stuff but it won’t enter the if statement.

```
if (FVector::DotProduct(GetVelocity(), GetActorRotation().Vector()) > (OriginalWalkSpeed * 1.5)) {
		if (SprintFloat) {
			FOnTimelineFloat TimelineProgress;
			FOnTimelineEventStatic TimelineEnd;

			TimelineProgress.BindUFunction(this, FName("BeginSprintTimelineFunc"));

			SprintTimeline.AddInterpFloat(SprintFloat, TimelineProgress);
			SprintTimeline.SetLooping(false);

			SprintTimeline.PlayFromStart();
			GetWorld()->GetFirstPlayerController()->PlayerCameraManager->PlayCameraShake(CamShake, 1.f);
		}

```

I know that it should work because I did that math in blueprint and printed it, it should enter to true. The weirdest part is it will enter the stop sprint if statement which is exactly the same.

```
if (FVector::DotProduct(GetVelocity(), GetActorRotation().Vector()) < (OriginalWalkSpeed * SprintMult)) {
		if (SprintFloat) {
			FOnTimelineFloat TimelineProgress;
			FOnTimelineEventStatic TimelineEnd;

			TimelineProgress.BindUFunction(this, FName("EndSprintTimelineFunc"));

			SprintTimeline.AddInterpFloat(SprintFloat, TimelineProgress);
			SprintTimeline.SetLooping(false);

			SprintTimeline.PlayFromStart();
			GetWorld()->GetFirstPlayerController()->PlayerCameraManager->StopAllInstancesOfCameraShake(CamShake, false);
		}
	}

```

Thanks in advance!
