The nested type `Distance' does not exist in the type `UnityEngine.Vector3'

I’ve been scripting in c# to make my character attack hostiles. I’ve encountered an error that I have no idea of how to solve. It says “Assets/Scritps/PlayerAttack.cs(22,46): error CS0426: The nested type Distance' does not exist in the type UnityEngine.Vector3’” and I have looked around on google for a while now, but it does not help sadly.

Here is the script

using UnityEngine;
using System.Collections;

public class PlayerAttack : MonoBehaviour {

public GameObject target;

// Use this for initialization

void Start () {

// Update is called once per frame
void Update () {
	if(Input.GetKeyDown(KeyCode.F)) {

private void Attack(){
	float distance = new Vector3.Distance(target.transform.position, transform.position);


	if(distance < 2.5f) {
	EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");
	if(eh != null){


Remove the ‘new’ from line 17. Vector3.Distance() is a method call. You are not creating a new instance of a Vector3.