Carrying Data Between Scenes

I have read that using DontDestroyOnLoad allows me to do so but its a variable i want to take to the next scene and not a game object how can i take the variable over?. Code is Below Part to focus on is the SetCountText function.

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

public class PlayerController : MonoBehaviour {
    private int count;
    public Text CountText;
    public Text WinText;

    public Text TimeText;
    private Rigidbody2D rb2d;
    public int Speed;

    private float time;

    void Start () // Sets up variables and text
    {
        count = 0;
        rb2d = GetComponent<Rigidbody2D>();
        WinText.text ="";
        SetCountText();
    }

    void Update ()
    {
        if(count < 8) // Sets time text to the current time of player
        {
            time = time + Time.deltaTime;
            TimeText.text = "Time:" + (int)time;
        }
    }
    void FixedUpdate ()
    {
        if(count < 8) // Allows the player to add forces to the game object
        {
            float moveHorizontal = Input.GetAxis ("Horizontal");
            float moveVertical = Input.GetAxis ("Vertical");
            Vector2 movement = new Vector2 (moveHorizontal, moveVertical);
            rb2d.AddForce(movement * Speed);
        }
        else // Stops the game object when the game is finished
        {
            rb2d.velocity = new Vector2 (0, 0);
        }
    }

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("PickUp")) // Allows only the game objects with the tag PickUp to be detected
        {
            other.gameObject.SetActive (false);
            count = count + 1;
            SetCountText();
        }
    }

    void SetCountText ()
    {
        CountText.text = "Count: " + count.ToString(); // Counts the ammount of pickup the player has collected
        if(count >= 8)
        {
            SceneManager.LoadScene("EndGame");
            WinText.text = "Your time was: " + (float)time;
        }
       
    }


}