Why script didn't work?

I have cube object, when NPC coming close to it, the boolean of atteched to NPC script didn’t changing.

public class AI_Object extends MonoBehaviour{

public var IsStayingObj : boolean;
public var IsWalkObj : boolean;
private var NPCs : GameObject[];	
			function Start(){
				//renderer.enabled = false;
				NPCs = GameObject.FindGameObjectsWithTag("NPC");
			function Update() {
				for(i = 0; i < NPCs.Length; i++)
					if (Vector3.Distance(NPCs*.transform.position,transform.position ) < 2){*

NPCs*.GetComponent(“AIAutoReact”)._isMoving = false;*

* }*

* }*_

* }*


This is because _isMoving is a property of the component and cannot be set.

You need to actually stop the gameobject from moving like so:

NPCs*.rigidbody.velocity = Vector3.zero;*

or similar if they aren’t controlled by physics.

Don’t make the variable static! Static members can only be accessed via the class and not by an instance!