Two game development questions

Hi, guys.

I need some help. How can I properly:

  1. let a player lose a life after falling into water, store the data, and let the player try again with fewer lives left
  2. and collect coins, earn points, and save the data between stages?

Here is the relevant part of the code.

    private void OnTriggerEnter2D(Collider2D other)
    {
        lives = 9;
        lifeboard.text = "Lives: " + lives;
        if (other.gameObject.tag == "coin")
        {
            myAudioSource.PlayOneShot(cent);
            Destroy(other.gameObject);
            score += 10;
            scoreBoard.text = "Score: " + score;
            if (score >= 100)
            {
                lives = lives + 1;
                lifeboard.text = "Lives: " + lives;
            }
            DontDestroyOnLoad(this.gameObject);
        }

        if (other.gameObject.tag == "goal")
        {
            myAudioSource.PlayOneShot(net);
            Time.timeScale = 0;
            results.text = "Mission Completed." + Environment.NewLine + "Press Space to continue.";
            if (Input.GetButtonDown("Jump"))
            {
                SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
            }
            DontDestroyOnLoad(this.gameObject);
        }

        if (other.gameObject.tag == "water")
        {
            myAudioSource.PlayOneShot(splash);
            Time.timeScale = 0;
            results.text = "Mission Failed." + Environment.NewLine + "Press Esc to restart.";
            lives = lives - 1;
            lifeboard.text = "Lives: " + lives;
            if (Input.GetButtonDown("Cancel"))
            {
                Scene thisScene = SceneManager.GetActiveScene();
                SceneManager.LoadScene(thisScene.name);
            }
            DontDestroyOnLoad(this.gameObject);
        }
    }

@burchland2 It has already been discussed here: unity - What is the proper way to handle data between scenes? - Game Development Stack Exchange (it works for both 2d and 3d). Hope that helps! If that doesn’t work or you don’t understand something, feel free to ask!