Don't know why but my player can't jump

I don’t know why but my player can’t jump.

Can sb help me fix this?

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

public class JumpController : MonoBehaviour
{
    private Rigidbody2D rb;
    [SerializeField] private bool isGrounded;
    [SerializeField] private Transform groundRayTransform;
    [SerializeField] private LayerMask groundLayer;

    [SerializeField] private int numJumps;
    [SerializeField] private int jumpForce;
    private int jumpsLeft;
    private float jumpTimer;
    // Start is called before the first frame update
    void Start()
    {
        rb = gameObject.GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        isGrounded = Physics2D.Linecast(transform.position, groundRayTransform.position, groundLayer);

        if (isGrounded == true && jumpTimer >= 0.5f)
        {
            jumpsLeft = numJumps;
        }

        jumpTimer += Time.fixedDeltaTime;
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (jumpsLeft > 0)
            {
                rb.velocity = Vector3.zero;
                rb.AddForce(Vector3.up * jumpForce);
                jumpsLeft--;
                jumpTimer = 0;
            }
        }
    }
}

Hi,

I was able to get an object to jump using your code, so it looks like it works as intended. You should make sure your “Jump Force” In the inspector is set to a large number, I had to set mine to 500 to get it to move.

Also, make sure your “Ground Layer” is set correctly. I attached a screenshot of what my inspector looked like.

The bottom image shows what my ground object looked like as well, so make sure that is set to the correct layer in the inspector. I circled it in blue to better describe what I am talking about.

JumpController2

Hope this helps.