Why does my Paddle stay in the middle after adding in the Mathf.Clamp code?

Hi I am currently remaking Pong and I am programming the Player in this case the paddle and everything was fine until I added the Mathf.Clamp code before I added it the paddle moved freely up and down, here take a look a the code:

public float speed = 10.00f;

    private Rigidbody2D rb2d;
    private float yPos;
    

    // Use this for initialization
    void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();
        
    }

    // Update is called once per frame

	void Update () {
        transform.position = new Vector2(transform.position.x, Mathf.Clamp(yPos, -3.3f, 3.3f));

        float moveVertical = Input.GetAxis("Vertical");

        Vector3 movement = new Vector3(0, moveVertical, 0);
        rb2d.velocity = movement * speed;

I don’t know what is wrong with the line of code, if anyone could help me resolve this issue it will be very appreciated.

Mathf.Clamp() will clamp the value so it will stay between the two values you have given as parameters. The 17th line ensures that the paddle will move freely on the X axis, however it will be clamped on the Y axis between -3.3f and 3.3f.

In your code, the paddle won’t be able to move on the Y axis, only between -3.3f and 3.3f. Vertical forces can be applied to it, but it will quickly return to the boundaries after the next frame.

What is the problem with this? What do you want to do with clamping?