My wall jump is inconsistent

I went over multiple tutorials and tried to piece them together to make a 2D platforming game. My wall jump is the only issue. It works sometimes randomly, not sure how to fix.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Common;
using System.Numerics;
using System.Runtime.CompilerServices;
using UnityEditor.Build;
using UnityEditor.Experimental.RestService;
using UnityEditor.Tilemaps;
using UnityEngine;
using UnityEngine.Assertions.Must;

public class Movement : MonoBehaviour
{
    [Header("Better Jumping System")]
    private float coyoteTime = 0.2f;
    private float coyoteTimeCounter;
    private float jumpBufferTime = 0.2f;
    private float jumpBufferTimeCounter;
    private float fallSpeedYDampingChangeThresh;

    //MOVEMENT
    private Rigidbody2D rb;
    private bool canMove;
    private BoxCollider2D box;
    private CircleCollider2D circ;
    private CapsuleCollider2D cap;
    private SpriteRenderer sprite;
    private Animator anim;
    private bool facingRight = true;

    [Header("Wall Slide System")]
    [SerializeField] private Transform wallCheck;
    [SerializeField] private float wallCheckDistance;
    private bool isWallDetected;
    private bool isWallSliding;
    private bool canWallSlide;
    [SerializeField] public LayerMask wallLayer;
    [SerializeField] private float wallSlidingSpeed = 0.2f;

    [Header("Wall Jump System")]
    private bool canWallJump = true;
    private int facingDirection = 1;
    [SerializeField] private UnityEngine.Vector2 wallJumpDirection;

    [Header("Physics")]
    public float buttonTime = 0.5f;
    public float jumpAmount = 20;
    public float jumpHeight = 5;
    public float cancelRate = 100;
    float jumpTime;
    bool jumping;
    public float gravityScale = 10;
    public float fallingGravityScale = 40;
    bool jumpCancelled;

    [SerializeField] private LayerMask jumpableGround;
    public bool isCrouched;

    private float dirX = 0f;
    private float dirY = 0f;

    [Header("Basic System")]
    [SerializeField] private float moveSpeed = 5f;
    [SerializeField] private float jumpEnergy = 6f;
    [SerializeField] private TrailRenderer tr;

    public Transform ceilingCheck;
    public float ceilingCheckLength;
    public LayerMask groundMask;

    private enum MovementState { idle, running, jumping, falling, sliding, crouching}

    // Start is called before the first frame update
    private void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        box = GetComponent<BoxCollider2D>();
        circ = GetComponent<CircleCollider2D>();
        cap = GetComponent<CapsuleCollider2D>();
        sprite = GetComponent<SpriteRenderer>();
        // attackpoint = GetComponent<Transform>();
        anim = GetComponent<Animator>();

        fallSpeedYDampingChangeThresh = CameraManager.instance.fallSpeedYDampingChangeThresh;
    }

    private void Flip()
    {
        facingDirection = facingDirection * -1;
        facingRight = !facingRight;
        transform.Rotate(0, 180, 0);
        wallCheckDistance = -wallCheckDistance;
    }

    private void FlipController()
    {
        //if (IsGrounded() && isWallDetected)
        //{
            //if (facingRight && dirX < 0)
                //Flip();
            //else if (!facingRight && dirX > 0)
                //Flip();
        //}

        if (rb.velocity.x < 0 && facingRight)
            Flip();
        else if (rb.velocity.x > 0 && !facingRight)
            Flip();
    }


    // Update is called once per frame
    public void Update()
    {
        
        CheckInput();
        UpdateAnimation();
    }


    private void WallJump()
    {
        UnityEngine.Vector2 direction = new UnityEngine.Vector2(wallJumpDirection.x * -facingDirection, wallJumpDirection.y);

        rb.AddForce(direction, ForceMode2D.Impulse);
    }

    private void FixedUpdate()
    {

        if (IsGrounded() || !isWallSliding)
        {
           canMove = true;
           Move();
        }

        if (jumpCancelled && jumping && rb.velocity.y > 0)
        {
            rb.AddForce(UnityEngine.Vector2.down * cancelRate);
        }

        if (isWallDetected && canWallSlide && !IsGrounded())
        {
            isWallSliding = true;
            canMove = false;
            rb.velocity = new UnityEngine.Vector2(rb.velocity.x, rb.velocity.y * wallSlidingSpeed);
        }
        else
        {
            isWallSliding = false;
            canMove = true;
            Move();
        }



    }

    private void CheckInput()
    {
        if (canMove)
        {
            dirX = Input.GetAxisRaw("Horizontal");
            dirY = Input.GetAxisRaw("Vertical");
        }


        bool hitCeiling = CeilingDetect();

        rb.velocity = new UnityEngine.Vector2(dirX * moveSpeed, rb.velocity.y);

        CollisionWall();
        FlipController();


        if ((Input.GetKeyDown(KeyCode.LeftControl) || hitCeiling) && IsGrounded())
        {
            isCrouched = true;
            anim.SetBool("Crouched", isCrouched);
        }

        if (Input.GetKeyUp(KeyCode.LeftControl))
        {
            isCrouched = false;
            anim.SetBool("Crouched", isCrouched);
        }

        if (rb.velocity.y < fallSpeedYDampingChangeThresh && !CameraManager.instance.IsLerpingYDamping && !CameraManager.instance.LerpedFromPlayerFalling)
        {
            CameraManager.instance.LerpYDamping(true);
        }

        if (rb.velocity.y >= 0f && !CameraManager.instance.IsLerpingYDamping && CameraManager.instance.LerpedFromPlayerFalling)
        {
            CameraManager.instance.LerpedFromPlayerFalling = false;

            CameraManager.instance.LerpYDamping(false);
        }



        if (IsGrounded())
        {
            coyoteTimeCounter = coyoteTime;
        }
        else
        {
            coyoteTimeCounter -= Time.deltaTime;
        }

        if (jumpBufferTimeCounter > 0f && coyoteTimeCounter > 0f)
        {
            rb.AddForce(UnityEngine.Vector2.up * jumpEnergy, ForceMode2D.Impulse);
            rb.gravityScale = gravityScale;
            jumping = true;
            jumpTime = 0;
            jumpCancelled = false;
            float jumpForce = Mathf.Sqrt(jumpHeight * -2 * (Physics2D.gravity.y * rb.gravityScale));
            rb.AddForce(new UnityEngine.Vector2(0, jumpForce), ForceMode2D.Impulse);

            jumpBufferTimeCounter = 0f;
        }


        if (Input.GetButtonDown("Jump"))
        {
            jumpBufferTimeCounter = jumpBufferTime;
        }
        else
        {
            jumpBufferTimeCounter -= Time.deltaTime;
        }

        if (Input.GetButtonDown("Jump") && rb.velocity.y > 0f)
        {
            rb.velocity = new UnityEngine.Vector2(rb.velocity.x, rb.velocity.y * 0.5f);

            coyoteTimeCounter = 0f;
        }


        if (Input.GetButtonUp("Jump") && isWallSliding && canWallJump)
        {
            WallJump();
        }


        if (jumping)
        {
            rb.velocity = new UnityEngine.Vector2(rb.velocity.x, jumpAmount);
            jumpTime += Time.deltaTime;

            if (Input.GetButtonUp("Jump") && IsGrounded())
            {
                jumpCancelled = true;
            }

            if (jumpTime > buttonTime)
            {
                jumping = false;
            }
        }

        if (Input.GetButtonUp("Jump") | jumpTime > buttonTime)
        {
            jumping = false;
        }
    }

    private void Move()
    {
        if (canMove)
        {
            rb.velocity = new UnityEngine.Vector2(dirX * moveSpeed, rb.velocity.y);
        }
    }

    private void UpdateAnimation()
    {
        MovementState state;

        if (dirX > 0f)
        {
            state = MovementState.running;
            // attackpoint.flipX = false;
        }
        else if (dirX < 0f)
        {
            state = MovementState.running;
            // attackpoint.flipX = true;
        }
        else
        {
            state = MovementState.idle;
        }

        if (isWallSliding)
        {
            state = MovementState.sliding;
        }

        if (rb.velocity.y >= .1f)
        {
            //rb.gravityScale = 1f;
            state = MovementState.jumping;
        }
        else if (rb.velocity.y < -.1f && !isWallSliding)
        {
            //rb.gravityScale = rb.gravityScale * 1.05f;
            state = MovementState.falling;
        }

        anim.SetInteger("state", (int)state);
    }   

    private bool IsGrounded()
    {
        // return Physics2D.CapsuleCast(cap.bounds.center, cap.bounds.size, CapsuleDirection2D.Vertical, .1f, Vector2.down, jumpableGround); [THIS DOESNT WORK YET]
        return Physics2D.CircleCast(circ.bounds.center, circ.radius, UnityEngine.Vector2.down, 1f, jumpableGround);
        // return Physics2D.BoxCast(box.bounds.center, box.bounds.size, 0f, Vector2.down, .1f, jumpableGround);
    }

    private bool IsWalled()
    {
        return Physics2D.OverlapCircle(wallCheck.position, 0.2f, wallLayer);
    }

    private void CollisionWall()
    {
        isWallDetected = Physics2D.Raycast(wallCheck.position, UnityEngine.Vector2.right, wallCheckDistance, groundMask);

        if (!IsGrounded() && rb.velocity.y < -.1f)
        {
            canWallSlide = true;
        }
    }



    bool CeilingDetect()
    {
        bool hit = Physics2D.Raycast(ceilingCheck.position, UnityEngine.Vector2.up, ceilingCheckLength, groundMask);
        return hit;

        // return Physics2D.CapsuleCast(cap.bounds.center, cap.bounds.size, CapsuleDirection2D.Vertical, .1f, Vector2.down, jumpableGround); [THIS DOESNT WORK YET]
        // return Physics2D.BoxCast(box.bounds.center, box.bounds.size, 0f, Vector2.up, ceiling);
  
    }
    private void OnDrawGizmos()
    {
        if (ceilingCheck == null) return;

        UnityEngine.Vector2 from = ceilingCheck.position;
        UnityEngine.Vector2 to = new UnityEngine.Vector2(ceilingCheck.position.x, ceilingCheck.position.y + ceilingCheckLength);
        Gizmos.DrawLine(wallCheck.position, new UnityEngine.Vector3(wallCheck.position.x + wallCheckDistance, wallCheck.position.y, wallCheck.position.z));
        Gizmos.DrawLine(from, to);
    }

    }