How to stop C# code from continuing a script?

Hello recently I implemented a shop system which I have mostly down. The one problem is if the player has no money it will not charge them but the adding of the item will still continue which I want to stop if the player doesnt have enough money. I need this to stop the script from another script.

Shop Script

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

public class Shop : ActionItem
{
    public GameObject ManaPotion;
    public GameObject CoinSystem;

    public AudioSource BuyPotion;
    public AudioClip BuyPotionClip;

    private void Start()
    {
        BuyPotion.clip = BuyPotionClip;
    }

    public void BuyManaPot()
    {
        CoinSystem.GetComponent<CoinSystem>().SubtractCoins(10);
        {
            inventory.AddItem(ManaPotion);
            BuyPotion.Play();
        }
    }
}

Coin System

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

public class CoinSystem : MonoBehaviour {

    public int Coins;
    public Text CoinText;

	// Use this for initialization
	void Start () {
        Coins = 0;
	}
	
    public void AddCoins(int CoinsToAdd)
    {
        Coins += CoinsToAdd;
        CoinText.text = "Coins:" +   Coins;
    }

    public void SubtractCoins(int CoinsToSubtract)
    {
        if(Coins - CoinsToSubtract < 0)
        {
            SubtractCoins(0);
            Debug.Log("You Didn't Have Enough Money!");
            return;
        }
        else
        {
            Coins -= CoinsToSubtract;
        }
    }
}

In the SubtractCoins method if I dont have enough I want it to send something to the other script telling it to stop the process of completing the code in the BuyManaPot() Method. Thank you!

Change your method to:

public bool SubtractCoins(int CoinsToSubtract)
{
    if(Coins - CoinsToSubtract < 0)
    {
        Debug.Log("You Didn't Have Enough Money!");
        return false;
    }
    else
    {
        Coins -= CoinsToSubtract;
        return true;
    }
}

Now when you call the method it returns only true when it successfully subtracted the requested amount, otherwise it returns false. So you can do something like this in the other script:

if (CoinSystem.GetComponent<CoinSystem>().SubtractCoins(10))
{
    inventory.AddItem(ManaPotion);
    BuyPotion.Play();
}

I cant seem to get this to work. I really need help for this or else I wont be able to continue with my shop. Can anyone else Help me?