How to make UI text appear on screen for a limited time then disappear

If you’ve played Skyrim or a similar game, when you pick up a bag of gold it will come up on screen saying how much gold was in said bag, I am trying to achieve this.

Basically when the player presses E when the raycast is looking at the bag it will give the player a random amount of gold, my problem is I can’t get the text that says “you collected ‘x’ amount of gold” to disappear from the screen after a few seconds, I have tried using coroutines but I don’t fully understand them despite watching Unity videos on it and looking at the docs.

Any help would be greatly appreciated, I think once I understand coroutines better I will realise that I’ve made some stupid mistake or completely misunderstood the concept of coroutines. I am still quite new to unity so don’t flame me please :slight_smile:

here is what I have so far:

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

namespace UnityStandardAssets.Characters.FirstPerson
    public class GoldBagController : MonoBehaviour, InteractableObject
        public GameObject goldBag;
        public PlayerController player;
        public CharUI charUI;
        public float bagAmount;
        public bool isGoldCollected;

        void Start()
            isGoldCollected = false;
            player.goldCount = 0;
            //charUI.goldAmount.text = "You got " + (int)bagAmount + " gold!";

        void Update()
            bagAmount = Random.Range(20f, 5000f);

        IEnumerator GoldAmountTip(string message, float delay)

            if (isGoldCollected == true) //when gold bag is collected add the gold to gold amount, remove the gold bag and print a message
                player.goldCount += (int)bagAmount;
                charUI.hoverTip.text = "";
                charUI.goldAmount.text = message;

            yield return new WaitForSeconds(delay); //delay for 3 seconds then set text to nothing, this is where I am having trouble
            charUI.goldAmount.text = "";

         * Interact method is called when player presses E when its raycast is looking at the gold bag
        public void Interact()
            isGoldCollected = true; 

            StartCoroutine(GoldAmountTip("You got " + (int)bagAmount + " gold!", 3));

Add a public int

public int delay=3;

then after the “waitforseconds” set gui/text to .enabled=false?

would that work?