How do I find a sprites direction in c#

This is what I have so far but it is not working
rotation = this.gameObject.GetComponent().rotation.z;

either euler.angle or spriteRenderer.FlipX … or at least thats how you flip it

If you are looking for getting the z rotation of the sprite then use transform.rotation.z

There is no need to use the Get component for transform.