Why am I getting SerializationException: Type 'UnityEngine.MonoBehaviour' etc.

I was trying to make a save and load system and everything is set up but when I press the save button I get these two errors:

and

Here is my code:

using UnityEngine;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

public static class SaveSystem
{  
    public static void SavePlayer (Player player) {
        
        BinaryFormatter formatter = new BinaryFormatter();
        string path = Application.persistentDataPath + "/save.arbf";
        FileStream stream = new FileStream(path, FileMode.Create);

        PlayerData data = new PlayerData(player);

        formatter.Serialize(stream, data);
        stream.Close();

    }

    public static PlayerData LoadPlayer ()
    {
        string path = Application.persistentDataPath + "/save.arbf";
        if(File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream stream = new FileStream(path, FileMode.Open);

            PlayerData data = formatter.Deserialize(stream) as PlayerData;
            stream.Close();

            return data;
        } else
        {
            Debug.LogError("Save file not found in " + path);
            return null;
        }
    }

}

Looks like your PlayerData class is extending MonoBehaviour and you’re trying to use the constructor, you cannot do that, if you want to use the constructor you need to remove MonoBehaviour and make it a regular C# class.