I am having problems with the script finding the prayers value

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class what : MonoBehaviour {

public UnityEngine.UI.Text prayDisplay;
public float prayers = 0.00f;
public int prayperclick = 1;
public Button click;
public UnityEngine.UI.Text itemInfo;
public float cost;
public int count = 0;
public int clickPower;
public string itemName;
private float _newCost;

// Update is called once per frame
void Update () {
    prayDisplay.text = "Prayers: " + prayers;
	itemInfo.text = itemName + "

Power: +" + clickPower;
}

public void Clicked(){
	prayers += prayperclick;
	
	
	
	
}

public void PurchasedUpgrade() {
	
if(click.prayers >= cost) {
	click.prayers -= cost;
	count += 1;
	click.prayperclick += clickPower;
	cost = Mathf.Round(cost * 1.15f);
	    _newCost = Mathf.Pow (cost, _newCost = cost);
}

}

}

You need to use GetComponent in order to reference a part of another gameobject. You also should not reference the float directly. Reference the script and the the float. So like this:

what What = click.GetComponent<what>();
what.prayers -= cost 

(etc.)