Character shaking all around the place. Need help.

I’m very new to coding and I managed to make my character move and jump. But what I’ve noticed is that the character always shakes and jitters when it moves, how do I stop it? This is my code:

public float moveSpeed;
public float jumpHeight;

void Update()
{

    if (Input.GetKey(KeyCode.S))
    {
        transform.Translate(Vector3.down * moveSpeed * Time.deltaTime);
    }

    if (Input.GetKey(KeyCode.W))
    {
        transform.Translate(Vector3.up * jumpHeight * Time.deltaTime);
    }
    if (Input.GetKey(KeyCode.D))
    {
        transform.Translate(Vector2.right * moveSpeed * Time.deltaTime);
    }

    if (Input.GetKey(KeyCode.A))
    {
        transform.Translate(Vector3.left * moveSpeed * Time.deltaTime);
    }
}

}

Forgot to mention that it’s in 2D

I guess you talk about platformer and hopefully have a Collider2D and Rigidbody2D attached to your player. If so, instead of translate your player, which is usually not a good idea because it basically teleports the gameobject completely ignoring the physics engine and it’s collisions, set the velocity of the rigidbody. but in FixedUpade, not Update.
so instead of translate set rigidbody2D.velocity to the same value and change Update to FixedUpdate.

@hexagonius

Can you give me an example of what the code would look like? I tried what you told me to do and it was wrong, it’s quite confusing, as I said, I am quite new to coding. I removed the “else” statement at the end and I think it’s better without it.