how to make a shop system

Hi I am having a problem and that problem is pretty straight I don’t know how to make a shop system and I need a shop system for my game I watched a lot of tutorials but nothing is working for me.
These are the scripts that will be used in the shop system.

these are the scripts that store score

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

public class PlayerHealth : MonoBehaviour
{

public GameObject death;
public int maxHealth = 100;
public static int currentHealth;
public HealthBar healthBar;
public GameObject gameOverPanel;


// Start is called before the first frame update
void Start()
{
    currentHealth = maxHealth;
    healthBar.SetMaxHealth(maxHealth);
    
}

// Update is called once per frame
void Update()
{
 
}



public void TakeDamage(int damage) 
{
    currentHealth  -= damage;

    healthBar.SetHealth(currentHealth);

    if( currentHealth  <= 0)
    {
        Die();
         
   
    }
}

void Die ()

{

 Destroy(gameObject);
 audioman.PlaySound ("explosion");
 Instantiate(death, transform.position, Quaternion.identity);
 PlayerPrefs.SetFloat ("Highscore",  PlayerPrefs.GetFloat("Highscore", 0) + ScoreScript.scoreValue);
 gameOverPanel.SetActive(true);
 ScoreScript.scoreValue = 0;
 //script.Score.text = (ScoreScript.scoreValue).ToString();
 //Time.timeScale = 0f;
 
}

}

and this is the script that displays saved score in shop menu ui

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

public class shop : MonoBehaviour
{
public TMPro.TextMeshProUGUI scoreText;
//public int[,] shopItems = new int[5,5];
//public float Highscore;
//public TMPro.TextMeshProUGUI scoreText;

void Start ()
{
scoreText.text = "Score : " + ((int)PlayerPrefs.GetFloat (“Highscore”)).ToString();

  //Items;
 /* shopItems[1, 1] = 1;
  shopItems[1, 2] = 2;
  shopItems[1, 3] = 3;
  shopItems[1, 4] = 4;

  //Price
  shopItems[2, 1] = 100;
  shopItems[2, 2] = 2500;
  shopItems[2, 3] = 3500;
  shopItems[2, 4] = 5000;

  //Quantity
  shopItems[3, 1] = 0;
  shopItems[3, 2] = 0;
  shopItems[3, 3] = 0;
  shopItems[3, 4] = 0;*/

}

/* public void Buy()
{
GameObject ButtonRef = GameObject.FindGameObjectWithTag(“Event”).GetComponent().currentSelectedGameObject;

if (Highscore >= shopItems[2, ButtonRef.GetComponent<GRIM>().ItemID])
{
  Highscore -= shopItems[2, ButtonRef.GetComponent<GRIM>().ItemID];
  scoreText.text = "Score : " + ((int)PlayerPrefs.GetFloat ("Highscore")).ToString();
}

}*/
}
These are the scripts I think will be needed in the shop system.
Ok so I have 4 fighter jets that the player can buy. I want these things to be happen when player buy the jet the cost will deduct from the overall score and if the player don’t have enough points it shows a error. But if the player has enough points the player gets the jet and buy button changes to equip button and the most important thing when the player clicks equip after buying the jet plane prefab he/she is using changes to the prefab they equipped. I think this is all the basics of shop system. But how can I do that? Please provide me the code for it and sorry for asking too much this my first time making a shop system and yes the fighter jets are not modifiers they are separate game object prefabs like vehicles.
Thankyou

Thankyou

Item Prices

First of all, you might want to have a dictionary of a list of items, alongside their price. For example:

public Dictionary<GameObject, float> ItemPrices = new Dictionary<GameObject, float>();

You would need using System.Collections.Generic; at the top of your script to access the dictionary class.


Then, you could fill in the values in the inspector of each item (gameobject) and their price (float). Alternatively, you can make the dictionary private, and change the values in the script:

Dictionary<GameObject, float> ItemPrices = new Dictionary<GameObject, float>()
{
    { Item1, 10f },
    { Item2, 7.50f },
    { Item3, 12.75 },
};

// etc...

Purchasing Items

If an item is purchased, you would need to search through the dictionary and look for the item you purchased, then minus the cost from the player’s currency. You might want to check if they can buy the item, before they purchase it:

void PurchaseItem(GameObject Item)
{
    foreach(KeyValuePair<GameObject, float> item in ItemPrices)
    {
         if (item.Key == Item)
         {
              // Take away the cost of the item from the player's currency
              playerCurrency -= item.Value;
         }     
    }
}

Saving Items

Finally, you could save a text file that contains any items the player has purchased. Or you could use playerPrefs to save the player’s current currency remaining. @Ashmit2020

@Llama_w_2Ls I did as you said to do this is the script after:

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


public class shop : MonoBehaviour
{
  public TMPro.TextMeshProUGUI scoreText;
    
    public Dictionary<GameObject, float> ItemPrices = new Dictionary<GameObject, float>();
    public GameObject Item1;
    public GameObject Item2;
    public GameObject Item3;
    public GameObject Item4;


  void Start ()
  {
      scoreText.text = "Score : " + ((int)PlayerPrefs.GetFloat ("Highscore")).ToString();


    Dictionary<GameObject, float> ItemPrices = new Dictionary<GameObject, float>()
    {
     { Item1, 1000f },
     { Item2, 2500f },
     {Item3, 3500f},
     { Item4, 5000f },
     };
  }

 

   void PurchaseItem(GameObject Item)
 {
     foreach(KeyValuePair<GameObject, float> item in ItemPrices)
     {
          if (item.Key == Item)
          {
               // Take away the cost of the item from the player's currency
               PlayerPrefs.GetFloat ("Highscore")) -= item.Value;
          }     
     }
 }
}

Can you please check it again and how will the script figure out which item is the player buying I have four items and four different buy buttons how are the buttons and script supposed suppose to figure that out please explain that. I am also having another problem at line 76 that is (PlayerPrefs.GetFloat ("Highscore")) -= item.Value;) I am storing the points that the player earned in a playerpref but when I command minus from playerpref like this "Highscore" -= item.Value; or PlayerPrefs.GetFloat ("Highscore")) -= item.Value; it shows errors can you please tell me how can I fix that.
ThankYou

@Llama_w_2Ls I am getting this issue about playerprefs:
Assets\scripts\shop.cs(41,18): error CS0131: The left-hand side of an assignment must be a variable, property or indexer even when I am doing this PlayerPrefs.GetFloat (“Highscore”) -= item.Value;
and how will I save what the player bought in a playerpref and how can I make buy button change to equip button after player successfully bought the GameObject. Then how can I make the equip button change the vehicle(GameObject) in the main game scene cuz the shop menu and the main game are in different scenes?