sprinting script for a FPS controller problem

if (Input.GetKeyDown(KeyCode.LeftShift)) { speed = speed * 2 } in the void update section if only multiplying speed by two for the frame i press it on.
How do i have it do it every frame i am holding down the key?

You should use if (Input.GetKey(KeyCode.LeftShift)) without the “down”. This returns true every frame the user presses the button. But remeber to chnage the code inside the if-statement. At the moment the player would double its speed every frame.

Input.GetKeyDown → When you press.

Input.GetKeyUp → When you Stop press.

Input.GetKey → When you hold the button down.

thank you both so much been struggling with that for a while :slight_smile: