Enemy Movement Script not working

So i watched a youtube tutorial recently and I was coding what he was writing but I have so many errors but he doesn’t here is my code:
using UnityEngine;
using System.Collections;

public class SlimeController : MonoBehaviour {

public float moveSpeed;

private Rigidbody2D myRigidbody;

private bool moving;

public float timeBetweenMove;
private float timeBetweenMoveCounter;
public float timeToMove;
private float timeToMoveCounter;

private Vector3 moveDirection;

// Use this for initialization
void Start () {
    myRigidbody = GetComponent<Rigidbody2D>();

    timeBetweenMoveCounter = timeBetweenMove;
    timeToMoveCounter = timeToMove;
	
}

// Update is called once per frame
void Update () {
	
    if (moving)
    {
        timeToMoveCounter -= Time.deltaTime;
        myRigidbody.velocity = moveDirection;
        
        if(timeToMoveCounter < 0f)
        {
            moving = false;
            timeBetweenMoveCounter = timeBetweenMove;
        }

    } else {
        timeBetweenMoveCounter -= Time.deltaTime;
        myRigidbody.velocity = Vector2.zero;

        if(timeBetweenMoveCounter < 0f)
        {
            moving = true;
            timeToMoveCounter = timeToMove;

            moveDirection = new Vector3(Random.Range (-1f, 1f) * moveSpeed, Random.Range(-1f, 1f), Random.Range(-1f, 1f), 0f);
        }
    }
}

}
if anyone can give me the right code or fix it thank you please i need help.

Try this:

public float moveSpeed;
	public float timeBetweenMove;
	private float timeBetweenMoveCounter;
	public float timeToMove;
	private float timeToMoveCounter;
	private Rigidbody2D myrigid;
	private bool moving;
	private Vector3 moveDirection;

	void Start()
	{
		myrigid = GetComponent<Rigidbody2D>();

		timeBetweenMoveCounter = Random.Range (timeBetweenMove * 0.75f, timeBetweenMove * 1.25f);
		timeToMoveCounter = Random.Range (timeToMove * 0.75f, timeToMove * 1.25f);

	}
	void Update()
	{
		if (moving) 
		{
			timeToMoveCounter -= Time.deltaTime;
			myrigid.velocity = moveDirection;	

			if (timeToMoveCounter < 0f)
			{
				moving = false;
				timeBetweenMoveCounter = Random.Range (timeBetweenMove * 0.75f, timeBetweenMove * 1.25f);
			}
			}else {
			timeBetweenMoveCounter -= Time.deltaTime;
			myrigid.velocity = Vector2.zero;
			if (timeBetweenMoveCounter < 0f)
			{
				moving = true;
				timeToMoveCounter = Random.Range (timeToMove * 0.75f, timeToMove * 1.25f);

				moveDirection = new Vector3 (Random.Range (-1f, 1f) * moveSpeed, Random.Range (-1f, 1f) * moveSpeed, 0f);
			}

		}
	}
}

it works thank you! so would this work for animals too???