accessing a boolean from another script.

I ve read many topics but i cannot find the answer to my problem.I have this code tha detects touch and the second tha checks if the boolean is true and executes some code.But it doesnt work

LEFT BUTTON SCRIPT

using UnityEngine;
using System.Collections;

public class LeftButton : MonoBehaviour 
{


	public bool moveLeft;
	

	
	void Update () 
	{
		//is there a touch on screen?
		if(Input.touches.Length <= 0)
		{
			//if no touches then execute this code
		}
		else //if there is a touch
		{
			//loop through all the the touches on screen
			for(int i = 0; i < Input.touchCount; i++)
			{
				
				
				//executes this code for current touch (i) on screen
				if(this.guiTexture != null  (this.guiTexture.HitTest(Input.GetTouch(i).position)))
				{
					//if current touch hits our guitexture, run this code
					if (Input.GetTouch(i).phase == TouchPhase.Stationary)
					{
						
						
						moveLeft = true;

					}
					
					if (Input.GetTouch(i).phase == TouchPhase.Ended)
					{
						
						moveLeft = false;

					}
				}
			}
		}
	}
}

MOVEMENT CONTROLLER SCRIPT

using UnityEngine;
using System.Collections;

public class MovementController : MonoBehaviour 
{
	public float maxSpeed = 3.0f;
	
	GameObject leftArrow;
	GameObject rightArrow;
	LeftButton scriptLeft;
	RightButton scriptRight;





		void Start () 
		{
	
			leftArrow = GameObject.Find ("Left Arrow");
			rightArrow = GameObject.Find ("Right Arrow");
			scriptLeft = rightArrow.GetComponent<LeftButton>();
			scriptRight = leftArrow.GetComponent<RightButton>();
			
		}

	

		void Update () 
		{
			
			
			

			if (scriptRight.moveRight == true)
			{
				anim.SetBool("moving",true);
				rigidbody2D.velocity = new Vector2 (maxSpeed, rigidbody2D.velocity.y);
			}

			if (scriptLeft.moveLeft == true)
			{
				anim.SetBool("moving",true);
				rigidbody2D.velocity = new Vector2 (-maxSpeed, rigidbody2D.velocity.y);
			}

I’ tried also

if (scriptRight.moveRight)
			{
				anim.SetBool("moving",true);
				rigidbody2D.velocity = new Vector2 (maxSpeed, rigidbody2D.velocity.y);
			}

			if (!scriptLeft.moveLeft)
			{
				anim.SetBool("moving",true);
				rigidbody2D.velocity = new Vector2 (-maxSpeed, rigidbody2D.velocity.y);
			}

Are you sure you are using the correct references?

scriptLeft = rightArrow.GetComponent<LeftButton>();

            scriptRight = leftArrow.GetComponent<RightButton>();

that doesn’t seem to make much sense. wouldn’t it be scriptLeft = leftArrow.GetComponent and so on?

have you tried checking if scripLeft!=null?

Yes you re right but even so the character sould be moving.What you are suggesting exactly?

Maybe use Debug.Log to be sure all your if statements are successful.

I export it as an apk to test it and as a result I can’t see the debug.