[SOLVED] How to detect if key was pressed in certain time frame

Hello

got it to work but i its the opposite of what i need in that it checks if youve pressed w and space at the sam time and its after 5 seconds i need it so it only works during a set time like 5 seconds

bruh:

if(this.app.keyboard.isPressed(pc.KEY_W) && this.app.keyboard.isPressed(pc.KEY_SPACE)){
  setTimeout(function(){
   this.entity.rigidbody.applyforce(-135,0,0);
  }.bind(this),5000);
}

wut

i just misunderstood mb