How to make robots attack my character

Hi, I’m new to this platform and I’m trying to get a robot to attack my character. I started with this:

Using UnityEngine;
Using System.Collections;

Public class chase: MonoBehaviour {

Public Transform player;
Private object Vector;

// Use this for initialization
Void Start () {


// Update is called once per frame
Void Update () {
    If (Vector3.Distance (player.position, this.transform.position) <10);
    Vector var; Direction = player.position - transform.position;
    This.transform.rotation = Quaternion.Slerp (this.transform.rotation,
        Quaternion.Slerp (this.transform.position));


But I see many mistakes
Please help me.

Describe the way you want your robot to attack

If having problems with health…