For Context, I'm pretty new to Unity, so I've followed a tutorial. Here is the link: https://www.youtube.com/watch?v=Oie-G5xuQNA
And for easier access to the code I will also be posting it here:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ButtonInfo : MonoBehaviour
{
    public int ItemID;
    public Text PriceText;
    public Text QuantityText;
    public GameObject ShopManager;
    // Update is called once per frame
    void Update()
    {
        PriceText.text = "Price: $" + ShopManager.GetComponent<ShopManagerScript>().shopItems[2, ItemID].ToString();
        QuantityText.text = ShopManager.GetComponent<ShopManagerScript>().shopItems[3, ItemID].ToString();
    }
}
And also here is the second script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ShopManagerScript : MonoBehaviour
{
    public int [,] shopItems = new int[5,5];
    public float coins;
    public Text CoinsText;
    void Start()
    {
        CoinsText.text = "Coins" + coins.ToString();
        // ID's
        shopItems[1, 1] = 1;
        shopItems[1, 2] = 2;
        shopItems[1, 3] = 3;
        shopItems[1, 4] = 4;
        // Price
        shopItems[2, 1] = 10;
        shopItems[2, 2] = 20;
        shopItems[2, 3] = 30;
        shopItems[2, 4] = 40;
        // Quantity
        shopItems[3, 1] = 1;
        shopItems[3, 2] = 1;
        shopItems[3, 3] = 1;
        shopItems[3, 4] = 1;
    }
    public void Buy()
    {
        GameObject ButtonRef = GameObject.FindGameObjectWithTag("Event").AddComponent<EventSystem>().currentSelectedGameObject;
        if(coins >= shopItems[2, ButtonRef.GetComponent<ButtonInfo>().ItemID])
        {
            coins -= shopItems[2, ButtonRef.GetComponent<ButtonInfo>().ItemID];
            shopItems[3, ButtonRef.GetComponent<ButtonInfo>().ItemID]++;
            CoinsText.text = "Coins" + coins.ToString();
            ButtonRef.GetComponent<ButtonInfo>().QuantityText.text = shopItems[3, ButtonRef.GetComponent<ButtonInfo>().ItemID].ToString();
        }
    }
}
And the last thing: Here is the error message itself:
NullReferenceException: Object reference not set to an instance of an object ShopManagerScript.Buy () (at Assets/Scrips/UI/Shop System/ShopManagerScript.cs:43)
 
     
    