How can I make my player jump up even if its upside down

Hello, I have a problem with my player movement script. When my player is upside down, or not right side up the player will not jump up but in the direction it is facing. How can I fix this?

Here is my player movement script:

void Update()
{
    if(Input.GetKeyDown(KeyCode.Space) && _isGrounded == true)
    {
        Debug.Log("Player has jumped");
        _isGrounded = false;

        rb.AddForce(transform.up * jumpForce, ForceMode.Force);
        
    }
}

Your problem is the use of transform.up because it’s a vector that represents the up direction from prespective of the gameObject it is attached to (same thing for transform.right , transform.foward , etc …)
What you need to do is use Vector3.up instead since it represents the global up direction for the world and it’s not related to a particular object.
This should work :

void Update()
{
    if(Input.GetKeyDown(KeyCode.Space) && _isGrounded == true)
    {
        Debug.Log("Player has jumped");
        _isGrounded = false;

        rb.AddForce(Vector3.up * jumpForce, ForceMode.Force);
        
    }
}