Problem setting value from another script

I have some different scripts to make the card game I am trying to make:

RandomSequence.cs

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

public class RandomSequence : MonoBehaviour {

	public ScriptableObject[] array;

	void Start () {
		RandomiseArray(array);
	}

	void RandomiseArray(ScriptableObject[] arr)
	{
		for (int positionOfArray = 0; positionOfArray < array.Length; positionOfArray++)
		{
			ScriptableObject obj = array[positionOfArray];
			int randomiseArray = Random.Range(0, positionOfArray);
			array[positionOfArray] = array[randomiseArray];
			array[randomiseArray] = obj;
		}
	}

}

This shuffles an array that I have which is made of scriptable objects (which store the values of the cards ready to put onto the card itself rather than writing them all out each time).

Next I have the display which puts the values from the scriptable objects onto the cards:

CardDisplay.cs

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

public class CardDisplay : MonoBehaviour {
	public CardStats card;
	public GameObject nameText;

	public GameObject stat1Text;
	public GameObject stat2Text;
	public GameObject stat3Text;
	public GameObject stat4Text;
	public GameObject stat5Text;

	public GameObject value1Text;
	public GameObject value2Text;
	public GameObject value3Text;
	public GameObject value4Text;
	public GameObject value5Text;

	public Image artworkImage;

	// Use this for initialization
	void Start () {
		nameText.GetComponent<TextMeshProUGUI>().SetText(card.name);

		stat1Text.GetComponent<TextMeshProUGUI>().SetText(card.stat1);
		stat2Text.GetComponent<TextMeshProUGUI>().SetText(card.stat2);
		stat3Text.GetComponent<TextMeshProUGUI>().SetText(card.stat3);
		stat4Text.GetComponent<TextMeshProUGUI>().SetText(card.stat4);
		stat5Text.GetComponent<TextMeshProUGUI>().SetText(card.stat5);

		value1Text.GetComponent<TextMeshProUGUI>().SetText(card.value1.ToString());
		value2Text.GetComponent<TextMeshProUGUI>().SetText(card.value2.ToString());
		value3Text.GetComponent<TextMeshProUGUI>().SetText(card.value3.ToString());
		value4Text.GetComponent<TextMeshProUGUI>().SetText(card.value4.ToString());
		value5Text.GetComponent<TextMeshProUGUI>().SetText(card.value5.ToString());
	}

}

They variable names are only temporary until i know what they will equate to in the game. Finally I have a script which should change the card variable from this script and make it so that the current card is the one chosen in the array. This will happen when a button is clicked but that is not important for my problem:

CardStackClick.cs

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

public class CardStackClick : MonoBehaviour {

	private RandomSequence randArr;
	public GameObject cardPrefab;
	private int clicks = 0;

	public void Clicked ()
	{
		if (clicks < 20)
		{
			ScriptableObject activeCard = randArr.array[clicks];
			cardPrefab.GetComponent<CardDisplay>().card = activeCard;
			clicks += 1;
		}
	}
}

I am trying to get a random card sequence each time the game is started and then to change the value on the card when the button is clicked to the next array value. The problem is that in the last script the line:

cardPrefab.GetComponent<CardDisplay>().card = activeCard;

Displays:

Assets/CardGame/Scripts/CardStackClick.cs(16,50): error CS0266: Cannot implicitly convert type `UnityEngine.ScriptableObject' to `CardStats'. An explicit conversion exists (are you missing a cast?)

In your CardDisplay class, the card variable is defined as:

public CardStats card;

So when you try to assign anything to the card variable, it expects you’re giving it a CardStats object. However, in your CardStackClick class, you’re assigning it a ScriptableObject instead:

ScriptableObject activeCard = randArr.array[clicks];
cardPrefab.GetComponent<CardDisplay>().card = activeCard;

There are a few solutions, but it depends on what you’re trying to do. I’m assuming that the RandomSequence class is actually a random sequence of CardStats objects. If that’s true, in your RandomSequence class, you could make all of your variables typed as CardStats instead of ScriptableObjects like so:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class RandomSequence : MonoBehaviour {
 
     public CardStats[] array;
 
     void Start () {
         RandomiseArray(array);
     }
 
     void RandomiseArray(CardStats[] arr)
     {
         for (int positionOfArray = 0; positionOfArray < array.Length; positionOfArray++)
         {
             CardStats obj = array[positionOfArray];
             int randomiseArray = Random.Range(0, positionOfArray);
             array[positionOfArray] = array[randomiseArray];
             array[randomiseArray] = obj;
         }
     }
 
 }

Then just make sure the activeCard variable in your CardStackClick class is also CardStats instead of ScriptableObject.