variable has not been assigned?

Hi, I’m pretty new to Unity, and I’m trying to design my own video game for a school project. The project has been going well so far, but i keep getting this error, something like… “The variable ‘whatever’ of ‘myscript’ has not been assigned, you probably need to assign it in the inspector”. But i have put my variable in, is it because its a transform? Oh and this happened when i added my two animation codes, it keeps on spamming me with the same error (but the script still works, and i’m able to play the game perfectly).
-my code

#pragma strict

var TheDamage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
var WeaponPipe : Transform;
function Update () 
	if (Input.GetButtonDown("Fire1"))
	//animation Attack

	//function attack
	var hit :RaycastHit;
	if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit))
	Distance = hit.distance;
	if (Distance < MaxDistance)
	hit.transform.SendMessage("ApplyDamage", TheDamage, SendMessageOptions.DontRequireReceiver);

	if (WeaponPipe.animation.isPlaying == false)

-credit goes to the Brackeys tutorial for helping me with the script

If you use public variables you must:

if it is a Transform or whatever:

  • Assign a Transform or whatever in the Inspector

  • or find a reference like:

     void Start () {
     	objRef = GameObject.FindGameObjectsWithTag("Player");

if it is an Integer or float or so

  • you can change the Value in the inspector

  • or declare it like:

    public float x = 20F;

if these are private Variables:

  • make sure you initialized them either when you declared them like above
  • or you inizialise them in Start(), Update() ect.

Hope that clears your problem.