I’m making an player-controller script & it allows you to jump infinitly. Does anyone know how to fix this? This is my code:
float leftRight;
float jump;
public float speed;
public float jumpSpeed;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
leftRight = Input.GetAxis("Horizontal");
jump = Input.GetAxis("Jump");
transform.Translate(Vector3.right * Time.deltaTime * speed * leftRight);
transform.Translate(Vector3.up * Time.deltaTime * jumpSpeed * jump);
}
}