Volume Slider not saving when changing scene

So I’m very new to Unity C# programming and I’m having a little bit of a problem with the background audio not saving when loading a new scene and then going back to the original scene.
I’ve heard about Singleton and Don’tDestoryOnLoad() but I still don’t fully understand how it works.
The code that I’ve tried I got from multiple Google searches but it still doesn’t work:

[RequireComponent(typeof(AudioSource), typeof(AudioSource))]
 public class VolumeSlider : MonoBehaviour
 {
     public AudioSource source;
     float volume = 0.5f;
 
     void Start()
     {
         source = GetComponent<AudioSource> ();
 
         source.volume = PlayerPrefs.GetFloat ("SliderBackground", source.volume);
     }
     void SaveSliderValue()
     {
         PlayerPrefs.SetFloat ("SliderBackground", volume);
     }
 }

I tried linking the script to the Audio source gameobject and then the Slider gameobject but neither work as intended. Any help on this would be greatly appreciated.

I was able to fix this by doing the following:

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

public class VolumeValueChange : MonoBehaviour
{

    // Reference to Audio Source component
    public AudioSource audioSrc;

    // Music volume variable that will be modified
    // by dragging slider knob
    public float musicVolume = 1f;

    void Awake()
    {
        musicVolume = PlayerPrefs.GetFloat("Volume", musicVolume);
    }
    // Use this for initialization
    void Start()
    {
        // Assign Audio Source component to control it
        audioSrc = GetComponent<AudioSource>();
        musicVolume = PlayerPrefs.GetFloat("Volume", musicVolume);
    }

    // Update is called once per frame
    void Update()
    {
        // Setting volume option of Audio Source to be equal to musicVolume
        audioSrc.volume = musicVolume;
    }

    // Method that is called by slider game object
    // This method takes vol value passed by slider
    // and sets it as musicValue
    public void SetVolume(float vol)
    {
        musicVolume = vol;
        PlayerPrefs.SetFloat("Volume", musicVolume);
    }
}