How do I use PlayerPrefs properly?

Hi,
I’m trying to use my code as a countdown and race timer, which all works completely fine. But I am unsure of how to use PlayerPrefs.SetString properly so that I can output my race time to another scene which displays statistics. After setting the string I will make another script which will get the string and display it on a GUI Text.

This is what I have so far:

using UnityEngine;
using System.Collections;

public class CountdownTimer : MonoBehaviour
{
	// declaration
	private GameObject ball;
	private GameObject ballPosition;
	
	public float timeRemaining = 4;

	private GUIText myText;

	public GUIText myTimer;
	private float startTime;
	private bool finished = false;


	void Start()
	{
		// assigns the game object "Ball" to private variable 'ball'
		ball = GameObject.Find("Ball");

		// assigns the game object "Ball Position" to private variable 'ballPosition'
		ballPosition = GameObject.Find("Ball Position");

		// assigns the GUI Text component to private variable 'myText' and 'myText2'
		myText = GetComponent<GUIText>();
	}


	void Update ()
	{
		// if the time remaining is greater than zero
		if (timeRemaining > 0.0f)
		{
			// initialises a countdown from timeRemaining float value, 4
			timeRemaining -= Time.deltaTime;

			// converts float to int and displays countdown on screen
			myText.text = ((int)timeRemaining).ToString();
		}

		if (timeRemaining > 1.0f)
		{
			startTime = Time.time;
		}

		// if the time remaining is less than one
		if(timeRemaining < 1.0f)
		{			
			// displays text on screen after the countdown finishes
			myText.text = "GO!";
		}

		// if the time remaining is less than zero
		if(timeRemaining < 0)
		{
			// disables the GUI Text component
			myText.enabled = false;
		}

		// if the time remaining is less than one
		if(timeRemaining < 1.0f)
		{
			// enables the Play Maker FSM component for user input
			ball.GetComponent<PlayMakerFSM>().enabled = true;
			ballPosition.GetComponent<PlayMakerFSM>().enabled = true;
		}

		if(finished)
			return;

		float t = Time.time - startTime;


		string minutes = ((int)t / 60).ToString();
		string seconds = (t % 60).ToString("f2");

		myTimer.text = minutes + ":" + seconds;
	}

	void OnTriggerEnter(Collider other)
	{
		ball.SendMessage ("Finish!");
		ball.GetComponent<PlayMakerFSM>().enabled = false;
	}

	public void Finish()
	{
		finished = true;

		if (finished = true)
		{
			PlayerPrefs.SetInt("Race Timer", myTimer);
		}
	}
}

Thanks in advance!

@Qxintero

The following saves the myTimer.text strng to PlayerPrefs in the Finish() function. I also added the functionality to load the statistics scene if you need it.

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class CountdownTimer : MonoBehaviour
{
    public GUIText myTimer;
    public string statisticsScene;

    public void Finish()
    {
        finished = true;

        if (finished = true) // why this conditional
        {
            PlayerPrefs.SetString("Race Timer", myTimer.text);
            if (statisticsScene != "") // the string statisticsScene must be set in the inspector or a constant value
            {
                SceneManager.LoadScene(statisticsScene);
            }
        }
    }
}

Next, the following Statistics script will set myTimer.text with the value from “Race Timer” in PlayerPrefs if it exists. If it does not it will display the default value of “00:00”.

using UnityEngine;
using System.Collections;

public class Statistics : MonoBehaviour
{
    public GUIText myTimer;

    void Start()
    {
        if (myTimer != null)
        {
            myTimer.text = PlayerPrefs.GetString("Race Timer", "00:00");
        }
    }
}