when i try checking if my player is upside-down im not sure the correct way to check as my code is not being run.

if (SubTrans.localRotation.z > 90 && SubTrans.localRotation.z < -90)
{
SubTrans.localScale = new Vector3(transform.localScale.x, -transform.localScale.y, transform.localScale.z);
}

Did you try googling it first?
Try This

i have tried but cant seem to find anything