Working on Camera Follow Code

Heya. I’m working on a camera follow code (but not rotate) that I got from another unity answer but I’m experiencing trouble with it.

Here’s the code:

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

public class camerafollowori (NAME OF SCRIPT) : MonoBehaviour {

var target : Transform;
var distance : Float;
function Update(){

	transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z - distance);

}

}

It keeps saying that the two : symbols next to target and distance are wrong.

Thanks for reading!

You have C# and UnityScript code mixed in here. Here’s the c# version for this code:

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

public class camerafollowori : MonoBehaviour
{
public Transform target;
public float distance;
 
	void Update(){
		transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z - distance);
	}
}