# How can I use a Variable as Value inside of a timeline?

**URL:** <https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4, Blueprint, question\
**Created:** [February 19, 2019, 6:18am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664 "2019-02-19T06:18:26Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Klimpertod](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Klimpertod](https://forums.unrealengine.com/u/Klimpertod)\
**Post date:** [February 19, 2019, 6:18am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664/1 "2019-02-19T06:18:26Z")

</div>

Hi, as you can see in the headline I am trying to set my Walkepeed with a timeline to slowly spow down.  
But I am using a Sprint funktion as well, so how can i use a variable in the timeline to slow down from the speed the pawn has at the time?  
Thanks. I apologize for my englisch.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 19, 2019, 10:27am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664/2 "2019-02-19T10:27:15Z")

</div>

> how can i use a variable in the  
> timeline to slow down from the speed  
> the pawn has at the time

You cannot (well, you can, but it’s fiddly and awkward), and that’s not what Timelines are used for. Their tracks are better used as alpha to interpolate between 2 set values.

* * *

In order to smoothly change player walking speed, it’s much better to _fInterpTo_ between 2 target values during tick - this will give you a smooth transition that can be interrupted (or reversed) much more elegantly than a timeline.

---

<div class="post-metadata">

**Author:** ![Klimpertod](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Klimpertod](https://forums.unrealengine.com/u/Klimpertod)\
**Post date:** [February 19, 2019, 11:34am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664/3 "2019-02-19T11:34:15Z")

</div>

Ok, thanks. Helped me a lot.

---

<div class="post-metadata">

**Author:** ![Klimpertod](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Klimpertod](https://forums.unrealengine.com/u/Klimpertod)\
**Post date:** [February 23, 2019, 8:38am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664/4 "2019-02-23T08:38:05Z")

</div>

Well, could you pls tell me, how the awkward way works?  
I tried it with the Finterp to, but i dont know how to break it, i used a while loop, but it said infinte loop.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 23, 2019, 10:21am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664/5 "2019-02-23T10:21:29Z")

</div>

While loop? Definitely not the right way to go. And do not pursue the timeline way, it’s not worth your time in this case - timelines have a specific use where you need to interpolate in precisely X amount of time. In your case, as you observed yourself, the current player speed is quite a fluid value.

The most basic sprint system would look like this:

 ![269401-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/2/f/52f485df5677e34027eef71984d34878adc28639.png)

For as long as you hold _shift_ the player speed is 1200, if not shift is pressed it goes back the 600. The _fInterpTo_ will smoothly change it between the 2 values based on its _Interp Speed_ (the higher, the faster the transition).

* * *

Not entirely sure what you’re after but if you need 5 different players speeds, I would build an _enumerator_ and plug it into the _Select_ node above. This will give you access to different movement speeds that can be easily modified by something that lives outside the player BP (entering shallow / deep water, stepping on a speed tile and so on). And it does not need to revolve around a player holding a key, of course.

If what I posted is not enough and you can’t get it to work the way you imagined, consider dropping a bit more of descriptive info regarding how you envisioned it! I’ll try to chip in what I can.

And good luck!

edit: typos

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 23, 2019, 11:28am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664/6 "2019-02-23T11:28:04Z")

</div>

So for example:

 ![269408-walkspeedwithenum.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/7/2a7afc635b10391e8c1ccc3362a27bae641d028b.png)

And any other blueprint can do something along the lines:

 ![269409-lb.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/1/4/814aa6abede8cde93b4270f927822777fae3889d.png)

Untested but _should_ work. Hope it helps.

---

<div class="post-metadata">

**Author:** ![Klimpertod](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Klimpertod](https://forums.unrealengine.com/u/Klimpertod)\
**Post date:** [February 23, 2019, 11:57am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664/7 "2019-02-23T11:57:58Z")

</div>

Thanks, but actually i am trying to create some kind of slide like in titanfall 2.  
I had a second question for that and i solved it based on that, but at the time it doesnt matter, if i am running or walking so i want it to slow down based on the velocity the pawn has at the time.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 23, 2019, 12:03pm UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664/8 "2019-02-23T12:03:16Z")

</div>

Not particularly familiar with Titanfall 2 mechanics (apart from wall running) but it sounds like the method I suggested is perfect for this.

> if i am running or walking so i want  
> it to slow down based on the velocity  
> the pawn has at the time.

Not following this bit at all. You want to slow down based on the current player speed? Surely, you want an external factor to modify your speed, right? I am confused, are you talking about time dilation or player movement speed - these are 2 completely different things!

---

<div class="post-metadata">

**Author:** ![Klimpertod](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Klimpertod](https://forums.unrealengine.com/u/Klimpertod)\
**Post date:** [February 23, 2019, 12:40pm UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664/9 "2019-02-23T12:40:13Z")

</div>

Player Movement Speed  
First i am checking if the velocity is my crouch speed  
Then i do have a timeline, wich goes from 1400(200 more than runspeed) to 300(crouch speed) and i am setting the MaxWalkSpeed to that value and then add a forward movement input as long as i hold Left Ctrl.  
Everything works fine, but it does it with 1400 when i am running, walking or wall running(yes, i do have that, but inspired by a video).

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 23, 2019, 12:49pm UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664/10 "2019-02-23T12:49:02Z")

</div>

Sorry, I don’t understand what you mean. I don’t even know at this point whether is works for you or still does not. Using a timeline for changing player speed is not a good idea, timelines are not dynamic enough. You have a working solution up there, take it or leave it. It will interpolate from any speed to any speed, any time, and smoothly, to boot.

Good luck.

---

<div class="post-metadata">

**Author:** ![ORTyOW](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ortyow/32/1169712_2.png) [@ORTyOW](https://forums.unrealengine.com/u/ORTyOW)\
**Post date:** [March 8, 2026, 3:41pm UTC](https://forums.unrealengine.com/t/how-can-i-use-a-variable-as-value-inside-of-a-timeline/443664/11 "2026-03-08T15:41:52Z")

</div>

You can’t but you can do it separately, using Timeline as an Alpha timer. Here is an example on how to interpolate between two different controller rotations:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/2/f/52ffaacfa0dbffb3f2a72a53d8a02dd1f594d1ac.jpeg)
