Y axis scales really fast

I’m making a game where you can extend and shrink your character, but when you extend, you immediately extend to the maximum height. This doesn’t happen when you shrink. Can anyone help?
Here’s my script in case you wanted to see it:

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

public class player1control : MonoBehaviour {

	public Rigidbody RB;

	// Use this for initialization
	void Start () {

	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown ("d")) {
			RB.velocity += 2 * Vector3.right;
		}
		if (Input.GetKeyDown ("a")) {
			RB.velocity += 2 * Vector3.left;
		}
		if (transform.localScale.y == 0.5f){
			if (Input.GetKeyDown ("w")) {
				transform.localScale += new Vector3 (0, 0.25f, 0);
			}
		}
		if(transform.localScale.y == 2f){
			if (Input.GetKeyDown ("s")) {
				transform.localScale += new Vector3 (0, -0.25f, 0);
			}
		}
		if (transform.localScale.y == 0.75f) {
			if (Input.GetKeyDown ("s")) {
				transform.localScale += new Vector3 (0, -0.25f, 0);
			}
			if (Input.GetKeyDown ("w")) {
				transform.localScale += new Vector3 (0, 0.25f, 0);
			}
		}
		if (transform.localScale.y == 1f) {
			if (Input.GetKeyDown ("s")) {
				transform.localScale += new Vector3 (0, -0.25f, 0);
			}
			if (Input.GetKeyDown ("w")) {
				transform.localScale += new Vector3 (0, 0.25f, 0);
			}
		}		
		if (transform.localScale.y == 1.25f) {
			if (Input.GetKeyDown ("s")) {
				transform.localScale += new Vector3 (0, -0.25f, 0);
			}
			if (Input.GetKeyDown ("w")) {
				transform.localScale += new Vector3 (0, 0.25f, 0);
			}
		}		
		if (transform.localScale.y == 1.5f) {
			if (Input.GetKeyDown ("s")) {
				transform.localScale += new Vector3 (0, -0.25f, 0);
			}
			if (Input.GetKeyDown ("w")) {
				transform.localScale += new Vector3 (0, 0.25f, 0);
			}
		}		
		if (transform.localScale.y == 1.75f) {
			if (Input.GetKeyDown ("s")) {
				transform.localScale += new Vector3 (0, -0.25f, 0);
			}
			if (Input.GetKeyDown ("w")) {
				transform.localScale += new Vector3 (0, 0.25f, 0);
			}
		}
	}
}

Change all of your “ifs” to “else ifs”. I think you’re likely incrementing or decrementing the scale and then hitting the very next “if” statement and returning true for that as well, etc… Just make it so that only one “if” statement is selected by adding “else if” to the rest, and it’ll likely solve your problem.

Just FYI though, you can simplify this a lot.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class player1control : MonoBehaviour {
 
     public Rigidbody RB;
 
     // Use this for initialization
     void Start () {
 
     }
     
     // Update is called once per frame
     void Update ()
    {
         if (Input.GetKeyDown (KeyCode.D))
             RB.velocity += 2 * Vector3.right;
         else if (Input.GetKeyDown (KeyCode.A))
             RB.velocity += 2 * Vector3.left;

         if (Input.GetKeyDown (KeyCode.S))
             transform.localScale += new Vector3 (0, -0.25f, 0);
         else if (Input.GetKeyDown (KeyCode.W))
             transform.localScale += new Vector3 (0, 0.25f, 0);

         transform.localScale = new Vector3(transform.localScale.x, Mathf.Clamp(transform.localScale.y, .5f, 2f), transform.localScale.z);
     }
 }