How to flip based on x pos properly?

if(gameObject.transform.position.x >= 0)
{
Vector3 bugbotScale = transform.localScale;
bugbotScale.x *= -1;
transform.localScale = bugbotScale;

		}

I’m trying to flip based on which side it is on screen. I works fine when not flipping but when it does it doesn’t stop. It just keeps flipping

Negative scale is something that you should always try to stay away from when working with colliders. Try this instead:

if(gameObject.transform.position.x >= 0)
{
    Vector3 newbugbotPosition = new Vector3(-transform.position.x, transform.position.y, transform.position.z);

    transform.position = newbugbotPosition;
    transform.Rotate(Vector3.up * 180, Space.World);
}

This should properly adjust the collider when the object flips and rotate it to face the opposite direction as well.