I’m trying to make it to where the enemy character slowly follows the player. i found this code in a form on here because i’m not the best with scripts. I’ve looked over the code a thousand times and can’t find why i am given the error. Here’s the script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class followPlayer : MonoBehaviour {
void Start () {
var Player; Transform;
var MoveSpeed = 4;
var MaxDist = 10;
var MinDist = 5;
function Start ()
{
}
function Update ()
{
transform.LookAt(Player);
if(Vector3.Distance(transform.position,Player.position) >= MinDist){
transform.position += transform.forward*MoveSpeed*Time.deltaTime;
}
}
// Update is called once per frame
void Update () {
}
}