Need some help with my Gravity Gun, New to Scripting.

Hi, I’m having trouble with static variables, I dont know why because I think I’m doing it right, maybe it’s not the way I wrote the Variable, maybe it’s the way the first code it written which two people helped me with.
I’m trying to create a Gravity Gun, so I have a Standby script which is placed on the Gun it’s self, then I have an Object script, the object script makes whatever it’s attached to follow the reticule on the gravity gun.

Here’s the Error I’m receiving BCE0005: Unknown identifier: 'Activate'.

    //do something

This is in the Object Script right before the function Update.

static var Activate = false;

This is in the Standby Script at the top.

Here’s what I’m trying to achieve, the Static var is what’s used to activate the function command inside the object script so it activates the script and it will follow the Gravity Gun’s reticule, the Static var is inside the Standby Script it is set to “false” as default, then it gets changedwhen I press the Left Mouse Button, it’s Supposed to change to static var Activate = true;

Here’s the standby script.

static var Activate = false;

function Update () {

if( Input.GetButtonDown("Fire1"))

//I’m also thinking about what I need to put here as It wont allow me to use the Variable inside here, I’ve tried (Activate==true); but I get the Error BCE0034: Expressions in statements must only be executed for their side-effects.


Please dont redo the Entire code, I dont want to go through all the hassle, I just want to help me sort out these errors.
I’m getting used to scripting, I’m learning where to put lines of codes now, I just need a bit more practice before I can consider myself “Good” at programming.
Please read and go over everything, I’ll post both scripts if nessasary.
Thanks for reading and contribution.

Man, your question is really confusing! What I understood from your question is that you want to set the variable Activate to true when the mouse left button is pressed, and this variable will be used in other scripts. Supposing I’m right, the Standby.js script should be something like this:

static var Activate = false;

function Update(){
    if (Input.GetButtonDown("Fire1")){
        Activate = true;

Since Activate is static, you can access it in other scripts as Standby.Activate:

if (Standby.Activate){ // you don't need to compare a boolean to true
    // do something