Whats wrong with my script

Hi guys, so Im having scripting, or maybe Unity, issues. Im making a simple shooting script, and its just not working, despite it working earlier when it has very similar. Its reporting back no errors. About half an hour ago, my script wasnt compiling full stop, now it is (if I enter just a random word, it returns an error, so thats something), but usually when you fire a raycast with no target, an error is returned. Not with this, nor is it showing a debug ray when I try, or executing the effects of HitByGun.
Heres the script

#pragma strict
var AllowFire : boolean = true;

function Start () {


function Update () {
if (Input.GetButton("Fire1")){
if (AllowFire == true){

function Shoot(){
AllowFire = false;
var rayhit : RaycastHit;
//var PlayRanger = transform.TransformDirection(Vector3(0,0,10));
var PlayRanger = transform.forward;
if (Physics.Raycast((transform.position + Vector3.up * 0.75),PlayRanger, rayhit)){
rayhit.transform.SendMessage ("HitByGun");
Debug.DrawRay (transform.position, PlayRanger, Color.green);
yield WaitForSeconds (0.2);
AllowFire = true;

Any advice for me?

First off, when declaring a variable in JS, you can do it like this:

var MyBoole = true;
var MyString = "";
var MyInt = 0;
var MyFloat = 0.0;

In these cases JS will automatically make the variable of the appropriate type.
Second, if your Start is not executing and there are no compile errors, then you didn’t attach the script to anything, OR it’s disabled on the GameObject it’s attached to, OR the GameObject it’s attached to is itself disabled.