three second timer.

Hi everyone,
I am creating a 3d flying camera game, where the camera flies around on all three axises, and I am trying to figure out how to get my “Overdrive” feature, that goes at 100f, to work Here’s my current code. I don’t currently have a timer feature set yet so yeah.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class move : MonoBehaviour
{
private bool stop = false;
public float smooth = 5.0f;
public float tiltAngle = 60f;
public float moveSpeed = 2f;

void Update()
{
    if (stop == false)
    {
        Vector3 movement = transform.rotation * Vector3.forward * moveSpeed * Time.deltaTime;
        transform.position += movement;
    }

    float tiltAroundY = Input.GetAxis("Horizontal") * tiltAngle;
    float tiltAroundX = Input.GetAxis("Vertical") * tiltAngle;

    Quaternion target = Quaternion.Euler(tiltAroundX, tiltAroundY, 0);
    transform.rotation *= target;

    if (Input.GetKeyDown(KeyCode.P))
    {
        stop = !stop;
    }
    if (Input.GetKeyDown(KeyCode.Space) && moveSpeed == 2f)
    {
    	moveSpeed = 20f;
    }
    else if (Input.GetKeyDown(KeyCode.Space) && moveSpeed == 20f)
    {
    	moveSpeed = 2f;
    }
    if (Input.GetKeyDown(KeyCode.O) && Input.GetKeyDown(KeyCode.Z) && moveSpeed == 20f)
    {
    	Debug.Log ("overdrive enabled")
     	moveSpeed = 100f;
	}
	else if (Input.GetKeyDown(KeyCode.O) && Input.GetKeyDown(KeyCode.Z) && moveSpeed == 100f)
    {
    	Debug.Log ("overdrive disabled")
    	moveSpeed = 2f;
    }
}

}

What am I doing wrong? Is there something that I missed when adding this? Also how to attach a timer to it is necesarry.

If I’ve learnt one thing in the past month of working in Unity, it’s that co-routines are good for timers. I don’t fully understand them per say, but I’ve managed to do a few things with various iterations of this script:

    [SerializeField]
    private float startTimer;
    private GameObject player;

    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        StartCoroutine("CountDown");
    }

    IEnumerator CountDown()
    {
        yield return new WaitForSeconds(startTimer);
        player.GetComponent<MovementController>().AllowMovement();
    }

something like this should be close to what you need:

    [SerializeField] private float OverdriveTime;

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Z))
        StartCoroutine("OverDrive"); //Start dat co-routine
    }

    IEnumerator OverDrive()
    {
        moveSpeed = 200f; //Become a fast boi
        yield return new WaitForSeconds(OverdriveTime);  //Wait the amount of time you want
        moveSpeed = 2f; //Become a slow boi
    }

Once you press space then simultaneously press O and Z overdrive is enabled but the code right after that immediately disables it because it is input.getkeydown() O and Z.