unity boosing car stops left rotation from working

i made a movement script with a limited boost function but when i press space and forward i cant use the left arrow key??

Edit: this code works but must use WASD

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class slipperyDrive : MonoBehaviour
{
    public float turnSpeed = 10;
    public float speed = 10;
    public float boostMultiplier = 3;
    public float boostCooldown = 5;
    public float boostDecrease = 20;
    public float boostIncrease = 10;
    private bool onCooldown, boosting;
    public float boost = 100;
    private float cooldownTimer;
    public Rigidbody rb;
    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        float rotation = Input.GetAxis("Horizontal") * turnSpeed; //this gives you an rotation: either -1 * turnspeed or 1*turnspeed
        float accel = Input.GetAxis("Vertical"); //The throttle input

        if (onCooldown == false && boost < 100 && boosting) //if we aren't boosting, the boost is not full and we aren't on cooldown, increase the boost with boostincrease per sec. 
        {
            boost += boostIncrease * Time.deltaTime;
        }

        if (cooldownTimer >= boostCooldown) //the cooldown is over then
        {
            onCooldown = false;
            cooldownTimer = 0;
        }


        if (Input.GetKey(KeyCode.Space))
        { //boost now
            boosting = true;
        }

        if (boosting && Input.GetKeyUp(KeyCode.Space))
        { //if we stopped boosting, set the cooldown
            boosting = false;
            onCooldown = true;
        }

        if (onCooldown)
        { //add to the cooldowntimer
            cooldownTimer += Time.deltaTime;
        }
        //and now for the movement:
        //rotate the car. 
       
        transform.Rotate(0, rotation, 0);
        //set a tempspeed
        float tempSpeed;
        //if we are boosting, set the speed to the speed * the multiplier
        if (boosting)
        {
            tempSpeed = speed * boostMultiplier;
        }
        else
        {
            //else just use the normal speed
            tempSpeed = speed;
        }
        rb.AddRelativeForce(Vector3.forward * tempSpeed * accel);  //this adds force relative to it's own transform
    }



}

Try this modified script to see if that works:

        float rotation = Input.GetAxis("Horizontal") * turnSpeed; //this gives you an rotation: either -1 * turnspeed or 1*turnspeed

 
         if (onCooldown == false && boostLeft < 100)
         {
             boostLeft += 1f*Time.deltaTime; //do this for framerate-independent increase. You had +1 every frame, now it is +1 every second
         }
         if (onCooldown == true && boosting == false)
         {
             cooldownTime += 1f*Time.deltaTime;//same story
 
         }
         if (cooldownTime >= 50)
         {
             onCooldown = false;
             cooldownTime = 0;
         }
         
             
             if (Input.GetKey(KeyCode.Space))
             {
                 boosting = true;
                 onCooldown = true;
               
             }
         if (Input.GetKeyUp(KeyCode.Space))
         {
             boosting = false;
             
         }
        /*
        no need to do this, you already have a rotation. 
         if (Input.GetKey(KeyCode.LeftArrow))
         {
             // rb.AddTorque(transform.up * turnSpeed *turn);
             transform.Rotate(0, rotation, 0);
 
         }
         
         if (Input.GetKey(KeyCode.RightArrow))
         {
             transform.Rotate(0, rotation - 360, 0);
             //  rb.AddTorque(transform.up * turnSpeed * turn);
         }
        */
//instead, you should do this:
 transform.Rotate(0, rotation, 0);
         if (boosting == false)
         {
             if (Input.GetKey(KeyCode.UpArrow))
             {
                 rb.AddForce(transform.forward * speed);
             }
         }
 
         if (boosting == true)
         {
             if (Input.GetKey(KeyCode.UpArrow))
             {
                 rb.AddForce(transform.forward * boostSpeed);
                
             }
             if (boostLeft > 0)
             {
                 boostLeft -= 1f *Time.deltaTime;
             }
             else
                 {
                 boosting = false;
                 }
         }

you should modify the values: it has a cooldowntime of 50 sec. now, and 1 boost increase and decrease per second.

Rens

The script in the post now works but it must use WASD and not the arrow keys so I’m still looking for a explanation.