Unable to change bool state from button

Hi Guys

I’m new to scripting and relatively new to Unity.

I need help achieving this:
A 2 button UI. One move button, and a shoot button.
When ‘move’ is clicked, clicking on the ground should move the player to the location.
When ‘shoot’ is clicked, clicking on the ground should shoot bullets at that position.

This is what is happening:
Move is working fine.
When shoot is clicked, the character is still moving.

Can somebody please help out? Thanks in advance.

Here is my script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
[System.Serializable]

public class PlayerMover : MonoBehaviour {

PlayerMotor motor;
public Transform shotSpawn;
public bool isMoving;
public LayerMask movementMask;
public GameObject bullet;
public float fireRate;
private float nextFire;

void Start () 
{
	motor = GetComponent<PlayerMotor>();
	isMoving=true;
}

public void ShootState(bool isMoving)
{
	isMoving=false;
	Debug.Log(isMoving); //this is just to see if the button click is doing what I want

}

public void MoveState(bool isMoving)
{
	isMoving=true;
	Debug.Log(isMoving); //this is just to see if the button click is doing what I want
}

void Update ()
{

	if(!EventSystem.current.IsPointerOverGameObject() && isMoving==true)
	{
		if(Input.GetMouseButtonUp(0))
		{		Vector3 pointer = Input.mousePosition;
				Ray ray = Camera.main.ScreenPointToRay(pointer);
				RaycastHit hit;
				if(Physics.Raycast(ray, out hit, 100, movementMask))
					{
						motor.MovetoPoint (hit.point);
						Debug.Log("running to ");
					}
				
		}
	}
		
	if(!EventSystem.current.IsPointerOverGameObject() && isMoving==false)
{
		if(Input.GetMouseButton(0))
		{
			Vector3 pointer = Input.mousePosition;
			Ray ray = Camera.main.ScreenPointToRay(pointer);
			RaycastHit hit;
			if(Physics.Raycast(ray, out hit))
				{
					transform.LookAt(hit.point);
					//nextFire=Time.time;
					//if(Time.time>nextFire)
				//{
					Instantiate(bullet, shotSpawn.position, Quaternion.identity);
					Debug.Log("Bullet fired");
					//nextFire=Time.time+fireRate;
				}
		}
	}
}

}

Does your button fire the ShootState() and MoveState()? If those methods fire the next thing to do is change “isMoving=” on lines 17 and 25 to “this.isMoving”. The bool passed to those methods (after the method name) is named the same as the field isMoving (at the top of the script). Thats why when in those methods you must specify which isMoving you mean. “this.isMoving” is the field and only “isMoving” is the bool passed to the methods. Alternatively you can rename one of the 2 and then “this.” will no longer be mandatory as it will be clear which one is meant.