Problem with player bouncing or jumping

So, I have tried all kinds of scripts for player to jump upwards or bounce off of a platform but none of them worked.
When I press Play, it looks like something is blocking my player from jumping or bouncing up.
This is the script from tutorial I found on YT, and it works fine for that person but not for me. I’m not sure what could be the problem but I think the problem is not in the script.

private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.GetComponent().velocity.y <= 0)
{
collision.gameObject.GetComponent().AddForce(Vector3.up * 60f);
}
}

I have managed to fix it. If anyone has the same problem I’ll write here the code that is attached to my platform.

public float jumpForce = 10f;

    void OnCollisionEnter2D(Collision2D collision)
    {

        Rigidbody2D rb = collision.collider.GetComponent<Rigidbody2D>();
        if(rb != null)
        {
            Vector2 velocity = rb.velocity;
            velocity.y = jumpForce;
            rb.velocity = velocity;
        }
    }