How can i make a dashing system?

Hello!

I want to make a dashing system for my game, one of those you find in combat/rpg games, when if you double tap W you dash/jump forward, dd and aa right and left.

First problem i encountered with that is how can i detect when a player double taps a key? I can make a script that detects when an input has begun but how can i tell if they press it twice (and in a short time spam)?

Second problem is how can i determinate the player’s left, right and front axis? So i can apply a force to that direction.

Those are the two issues i need to deal with, if someone could enlighten me it would be great, thanks!

You can use tick() to detect how much time has passed since an input:

local Down = tick()
task.wait(1)
ButtonDown.Event:Wait()
print(tick() - Down)