how do i make a double press button within a time limit

what i want to make is like dash state which gets activated when i double tap a direction within a time limit.
i have state variable for the state machine and a evade variable that changes the state and keeps track of my direction (positive is right, negative is left)
what am i doing wrong or is there a better way of doing this?