Stopping a timeline when trace is false

Hi there I couldn’t really think of a good title but what I am trying to do is have a crank that I can ‘use’ which will in turn open a door, the door part I am not up to yet because I’ve come across a little problem, what I have is a trace that is constantly firing to check if there is something usable in front of the character, if that trace detects something and then the use key (‘E’) is pressed it will activate it.

For the crank, what it is doing is playing a timeline that essentially rotates the crank on the spot which does work, but when I move away from the crank and the trace cannot pick it up anymore, the crank will still be rotating as long as the key is down, If I release the key however it stops like normal and wont activate again until the trace picks it up.

I will post a couple of pics to show what is going on.
Blueprint

Trace firing

Crank still rotates even though it’s not in the trace anymore.

Releasing the key and pressing it again returns the message so I know it doesnt find anything, this message should play when I get out of range from the crank, but it only does it if I’m already out of range and press the key

Any help would be much appreciated, also if someone wanted to set me on the path to getting the door to move aswell that would be so helpful, I think I have an idea on how to do it, but I have yet to try it out.

Thanks.

So I’ve made some changes to the blueprint and have gotten it almost working, I’m still having the same problem with it not updating the trace results while the button is down.

You can see here that it’s now just controlling a variable. It still doesn’t set the var to false when the trace is negative.

EDIT:

A silly mistake from my end, adding a delay with a 0.1 on the end of the set using to true, and linking that back to the check will have it update on the fly, which fixes the big issue, but in its place a new issue popped up.

Now what happens is I will get into the right distance, and press use it will do nothing, but as soon as I release the key the timeline will kick in and go until completion or I get out of trace range, pressing the button quickly will do nothing until released and then it will swap directions…

Try this, does it work?

All the best.