Convert float to ui text

Hello, i need help to make a UI text element display a float value, i thought i fixed it with help from the internet but it doesnt add 1f for every log i pick up… (every “log” has this script)

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

public class PickUpLogs : MonoBehaviour {

	private bool InCollider;
	public float LogAmount;
	public UnityEngine.UI.Text TextLogAmount;

	void Start ()
	{
		TextLogAmount = GameObject.Find ("LogAmountText").GetComponent<UnityEngine.UI.Text>();
	}

	void Update ()
	{
		TextLogAmount.text = LogAmount.ToString();

		if(InCollider == true)
		{
			if(Input.GetKeyDown(KeyCode.F))
			{
				Debug.Log ("Added_1_Log");
				LogAmount += 1f;
				Destroy(gameObject);
			}
		}
	}

	void OnTriggerEnter (Collider col)
	{
		if (col.tag == "Player")
		{
			InCollider = true;
		}
	}

	void OnTriggerExit (Collider col)
	{
		if (col.tag == "Player")
		{
			InCollider = false;
		}
	}
}

LogAmount += 1f;
Destroy(gameObject);
It does add 1f… and then immediately destroys the gameobject this script is on. You can’T assign a UI Text value as a reference to a float variable. Hence, you need to update the UI Text every time you want to change something.

if(Input.GetKeyDown(KeyCode.F))
             {
                 Debug.Log ("Added_1_Log");
                 LogAmount += 1f;
                 TextLogAmount.text = LogAmount.ToString();
                 Destroy(gameObject);
             }

The gameObject is getting destroyed without the text being updated. Don’t you want to update the text first then destroy the pick up?