Script Not Working For AI

Hello! I am VERY new to unity and am trying to make a basic AI. If somebody could help me with this code it would be very helpful!

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

public class SkeletonAI : MonoBehaviour {

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
if(Vector3.Distance(Player.position, this.transform.position) > 10)
{
Vector3 direction = player.position - this.transform.position;

this.transform.rotation = Quaternion.Slerp (this.transform.roation);
Quarternion.LookRotation(direction); 0.1f);
}
}
}

You’ve missed a ‘t’ out of rotation and used ‘;’ instead of ‘,’ in the ‘this.transform.rotation =’ line.

Without code tags it’s harder to read, you should really use those for any code snippets you post.

1 Like