Diamond 2D sprite bounce

I have created 3 different enemies. The only one that does not work is this one. I rotated it 90 degrees on the z axis. If I put the rotation to 0 degrees, it works fine. I have also tried to use different directions in the script. I have used right, left, up, down. I have changed the ray cast to different directions also. Here is what I have for the script. Let me know if you need to see any of the inspector settings. I appreciate any help.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DiamondPatrol : MonoBehaviour
{

    public float speed;
    public float distance;

    private bool movingRight = true;

    public Transform groundDetection;


    // Update is called once per frame
    void Update()
    {
        transform.Translate(Vector2.right * speed * Time.deltaTime);

        int layer_mask = LayerMask.GetMask("Ground");
        RaycastHit2D groundInfo = Physics2D.Raycast(groundDetection.position, Vector2.down, 2.0f, LayerMask.GetMask("Ground"));

        if (groundInfo.collider == false)
        {
            if (movingRight == true)
            {
                transform.eulerAngles = new Vector3(0, -180, 0);
                movingRight = false;
            }
            else
            {
                transform.eulerAngles = new Vector3(0, 0, 0);
                movingRight = true;
            }
        }
    }
}

By it doesnt work, what exactly do you mean?
What is it supposed to do?

Sorry, It is supposed to patrol the ledge there. Like the other ones.

https://www.youtube.com/watch?v=_EuP-nb66SY