Problem with unityengine.transform:/

Hello,

im new:) I have coded this code:

#pragma strict
var TheDammage : int = 30;
var Distance : float;

function Update ()
{
if (Input.GetButtonDown(“Fire1”))
{
var hit = RaycastHit;
if (Physics.Raycast (Transform.position, transform.TransformDirection(Vector3.forward), hit))
{
Distance = hit.distance;
hit.transform.SendMessage(“ApplyDammage”, TheDammage, SendMessageOptions.DontRequireReceiver);
}
}
}

But there are 3 Errors?! :open_mouth:

Nr.1 : transform is not a member of System.Type Nr.2 : distance is not a member of System.Type Nr.3: An instance of type UnityEngine.Transform is required to access non static meber position

Can someone help me?

Welcome to the forum!

Please use code tags, because the code becomes more readable and there are line numbers:
http://forum.unity3d.com/threads/143875-Using-code-tags-properly

There is a syntax error:

var hit = RaycastHit;

You want to define that hit is of type RaycastHit which means it has to look as follows:

var hit : RaycastHit;
Transform.position

should be

transform.position

The name of the variable is transform which is lower case. The class is named Transform, but that’s not what you want here.