Dash ability wont properly work [need help]

So I made a dash system that speeds up the player until you run out of fuel.
You can cancel the dash by releasing the input key (CTRL)
I want there to be a minimum amount of time (0.3 seconds) before you can cancel the dash while dashing.
So for example: You press and immediatly release the dash key, but that doesn’t stop the dash, you always dash and can’t cancel it for the first 0.3 seconds and after that, you can cancel.
The cancelling works but the 0.3 seconds thing doesn’t
I’ve spend 2 hours trying to figure this out but i couldn’t.
I really need help for this.
(All the dash code is in the images)



My variables

image

The “IsFlying” variable isn’t important here i think since that’s for a different ability.

If the button gets released before can cancel dash toggles it seems like it would just get stuck dashing until you pushed again and released after it toggled. IMO you should get rid of the delays completely, use retriggerable delays or use a timeline for this ability, timelines can do anything. If you press the button twice the delays are going to be ignored and trigger at weird times, it would be really hard to make them work reliably. It is sometimes hard to understand other peoples code though, so maybe you have planned ahead for this.

1 Like