My 2d character gets stuck on a wall if i run against it

I saw the slippery solution, but it doesn’t work for me

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

public class PlayerController : MonoBehaviour
{
    public float moveSpeed = 5f;
    public float jumpValue = 5f;
    public bool isGrounded = false;
    private bool lookingRight = true;
    public float decayRate = 5f;
    public float negativeJump;
    public float moveDivide = 1.5f;

    public Animator animator;
    public new Rigidbody2D rigidbody2D;
    public BoxCollider2D boxcollider2D;

    public bool isFalling = true;
    public bool isJumping = false;
    public bool isCrouching = false;

    

    void Update()
    {

        //FUNÇÕES JOGABILIDADE
        Crouch();
        Jump();
        



        //movimento
        Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0f, 0f);
        transform.position += movement * Time.deltaTime * moveSpeed;

        //Virar dependendo do movimento
        if (movement.x > 0 && lookingRight == false)
        {
            Flip();
            lookingRight = true;
        } else if (movement.x < 0 && lookingRight == true)
        {
            Flip();
            lookingRight = false;
        }

        //Animação corrida
        animator.SetFloat("speed", Mathf.Abs(movement.x));

        //Pulo decay
        negativeJump = jumpValue * -1 / 4;
        

        //FUNÇÕES ANIMAÇÃO
        JumpCheck();
        JumpAnimate();
        CrouchAnimate();


    }


  

    void JumpCheck()
    {
        if (rigidbody2D.velocity.y < -0.1)
        {
            isFalling = true;
            isJumping = false;
        }
        else if (rigidbody2D.velocity.y > -0.1 && isGrounded == false)
        {
            isFalling = false;
            isJumping = true;
        }
        else
        {
            isFalling = false;
            isJumping = false;
        }
    }





    //animações do pulo
    void JumpAnimate()
    {
        if (isJumping == true)
        {
            animator.SetBool("isJumping", true);
        }
        else
        {
            animator.SetBool("isJumping", false);
        }

        if (isFalling == true)
        {
            animator.SetBool("isFalling", true);
        }
        else
        {
            animator.SetBool("isFalling", false);
        }

    }

    //pulo
    void Jump()
    {
        if (Input.GetButtonDown("Jump") && isGrounded == true)
        {
            gameObject.GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, jumpValue), ForceMode2D.Impulse);
        }


        if (Input.GetButtonUp("Jump") && isJumping == true)
        {
            rigidbody2D.AddForce(new Vector2(0f, negativeJump), ForceMode2D.Impulse);
        }

    }


    private void Flip()
    {
        // Switch the way the player is labelled as facing.
        lookingRight = !lookingRight;

        // Multiply the player's x local scale by -1.
        Vector3 theScale = transform.localScale;
        theScale.x *= -1;
        transform.localScale = theScale;
    }


    // Detectar se agachou ou não
    void Crouch()
    {
        if (Input.GetButtonDown("Crouch"))
        {
            moveSpeed /= moveDivide;
            boxcollider2D.enabled = false;
            isCrouching = true;

        }
        else if (Input.GetButtonUp("Crouch"))
        {
            boxcollider2D.enabled = true;
            isCrouching = false;
            moveSpeed *= moveDivide;
        }
    }


    void CrouchAnimate()
    {
        if (isCrouching == true)
        {
            animator.SetBool("isCrouching", true);
        }
        else if (isCrouching == false)
        {
            animator.SetBool("isCrouching", false);
        }
    }
}

If your using Tilemaps I found that adding an EdgeCollider2D to the gameobject instead of a BoxCollider2D works good