Raycast Help

I made this script but I am having promblems with it. I want it to change a boolean on another object so you can interact with it. I am trying to use GetComponent as well. thank you for your help. And I hope you have a great day.

#pragma strict
var Range : int = 1;

function Update () {

if (Input.GetButtonDown (“Interact”))
{

var hit : RaycastHit;

var fwd = transform.TransformDirection (Vector3.forward);

 if (Physics.Raycast (transform.position, fwd, Range)&& tag == ("Interact")) 
{ 

var InteractedObject = hit.GetComponent(MyInteraction);

}

}

}

I’m no js expert, but I believe it should go something like

var InteractedObject : MyInteraction = hit.transform.GetComponent(MyInteraction);

InteractedObject.yourBoolean = false;