I just want to flip an enemy baed on their velocity

Every question regarding writing code to flip an enemy’s localScale, it has to do with it facing the player.

I just want to change an enemys localscale based on if they’re moving left to right.
I want to change the local scale from 1 to -1 or vice versa if their x velocity is in the positive or negative

Try something like this (Haven’t tested it but I think it should work) If rb is the RigidBody2D:

if (rb.velocity.x >= 0f)
    transform.localscale = Vector2.right
else
    transform.localscale = Vector2.left