Change variable in a script from another script

var objectWithTheScript : GameObject;
var theScript;

function Start() {
    theScript = objectWithTheScript.GetComponent("The Scripts Name");
function Update() {
    theScript.variableInTheScript = true;

Using this script, unity debug give me an error. “variableInTheScript is not an argument of Object”
The variable is setted up as public.

I’ll be giving an example in C#, it shouldn’t be hard to translate into Unityscript.

This is how to access the script

public class Health1 : MonoBehaviour {

// Access Health Script
public NameOfYourScript WhatEverYouWantToCallIt; < this is a variable you call it inside THIS script.
So do public NameOfYourScript then call it what you want.
example - public Health thisHealthScript;

Then you can do something such as.

if(thisHealthScript.currentHealth <=1){

What that did was, if thisHealthScript (which is a name you gave it in THIS health script for your health to access the real script) so if thisHealthScript is less than or equal to 1, then run the Die function.

I hope this made sense.... I just gave you the basic crash course on how to access another scripts variable and do stuff with it.

I know it wasn’t in the same context as your current script, but I just gave you a bit from my script and hoped it made sense.

Hope that helps!