Can't make a variable be called from another script


I have a variable, a boolean, in a script. I want to call it in another script.

For some reason it doesn’t work, the conditions are not met when I try a condition on it (the weapon should shoot, it doesn’t).

The script is well referenced in the inspector and the boolean is set to False by default in both scripts.

Here is an exerpt from the script with the variable (carrying):

var catchRange = 30.0;
var holdDistance = 4.0;
var minForce = 1000;
var maxForce = 10000;
var forceChargePerSec = 3000;
var layerMask : LayerMask = -1;
static var carrying : boolean = false;

enum GravityGunState { Free, Catch, Occupied, Charge, Release};
private var gravityGunState : GravityGunState = 0;
private var rigid : Rigidbody = null;
private var currentForce = minForce;

function FixedUpdate () {
	if(gravityGunState == GravityGunState.Free) {
		if(Input.GetButton("Fire3")) {
			var hit : RaycastHit;
			if(Physics.Raycast(transform.position, transform.forward, hit, catchRange, layerMask)) {
				if(hit.rigidbody) {
					rigid = hit.rigidbody;
					gravityGunState = GravityGunState.Catch;
					// for debuging, remove it
					//print("force: " + currentForce);
	else if(gravityGunState == GravityGunState.Catch) {
		rigid.MovePosition(transform.position + transform.forward * holdDistance);
		rigid.rigidbody.useGravity = false;
		carrying = true;
			gravityGunState = GravityGunState.Occupied;


Here is the receiving script (a weapon):

var projectile_enlarge : Rigidbody;
var speed = 100;
var Carry : MonoScript;
var state : boolean = false;

function Update () {

if (Input.GetButtonUp ("Fire1"))
state = Carry.carrying;
 if (state == false)
 clone = Instantiate(projectile_enlarge, transform.position, transform.rotation);
 clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed));
 Destroy (clone.gameObject, 5);




I can’t get what’s wrong, it looks exactly like it should be according to answers found on this website. I’ve also tried many combinations without success.

You cannot simply attach another script to check the boolean value. Think about the fact that that script you dragged onto the variable Carry is not actually attached to any object. Yes you have placed the same script on an object, but they script that is assigned to the Carry object does not reference the one attached to the object you are trying to read from. You will need to get the FindGameObjectWithTag() or something similar and then do gameObject.GetComponent().carrying.