Click To Revert to Original Texture else Destroy script help

Need Help with scripting problem. I am trying to make a City Building game where the building will randomly destroy if not clicked. The script does change the texture to “txture” and destroy it. The problem now is that the script still doesn’t change/revert to “original.” i Think the problem lies with the Raycast problem. Any solution for this will be helpful. Thanks

var Txture : Texture;
var Original : Texture;

function Start ()
{
 InvokeRepeating ("Riot", 1, 1);
 }

function Riot() {
var RiotRandom : int = Random.Range(1,100);
    if (RiotRandom > 1) {
       renderer.material.mainTexture = Txture; 
       }
       InvokeRepeating ("Destroyz", 5, 1);
 }
 
function Destroyz() {
if(Input.GetMouseButtonDown(0)){
		var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		var hit : RaycastHit;
if(Physics.Raycast(ray,hit, 150) &&(hit.transform.tag == "Bd1"))
{
	renderer.material.mainTexture = Original;
}
}
		else
	{
       Destroy(gameObject);
       }
       }

Note: Bd1 is the building tag & I Put this script at the building, not camera

There are a couple of strange thing here. First on Line 14, you have a InvokeRepeating(). This is going to cause a new InvokeRepeating() every time Riot() is called (without canceling the old one). You probably want just Invoke(). Second, GetMouseButtonDown() is only true for a single frame that the button is held down, so the chance that it will be true for the same frame that Destroyz() is called is vary small. Here is a bit of a rewrite to your code that gets closer to what I think you want:

var Txture : Texture;
var Original : Texture;

private var doDestroy = false;
 
function Start () {
 InvokeRepeating ("Riot", 1, 1);
 }
 
function Riot() {
var RiotRandom : int = Random.Range(1,100);
    if (RiotRandom > 1 && !doDestroy) {
       renderer.material.mainTexture = Txture; 
       doDestroy = true;
       Invoke("Destroyz", 5);
       }
 }
 
function Destroyz() {
	Debug.Log(doDestroy.ToString());
	if (doDestroy)
       	Destroy(gameObject);
}

function OnMouseDown() {
	renderer.material.mainTexture = Original; 
	doDestroy = false;
}