[2D] How to stop my character on slopes?

I’ve got issue with slopes and chaarcter. When I’m going in a high slope, my character goes up (exactly this) and I don’t want it. When program prints “On high slope” I want to make fall character down and be unable to walk on slopes, but I don’t know how to do this. Maybe I’m approaching it wrong. Thanks in advance.

//I just have high slope detection
//I put it in FixedUpdate()
private void Slope() {
        RaycastHit2D hit = Physics2D.Raycast(transform.position, -Vector2.up, 3f, whatIsGround);
        if (hit.collider != null) {
            if (Mathf.Abs(hit.normal.x) > maxSlope) {
                print("On high slope");

Are you using a RigidBody or only a BoxCollider? And what code are u using to move it around?