Can't restart a level

I made my first minigame where you shoot to objects and if there are more then 10 objects on the screen you lose. I wanted do let player press R after lose to restart a level but it’s not happaning. I see that level is reloading but everything is the same. There is still “Gameover text” display, there are more spawned objects then before and so on. I’ve tried with enter code here Application.LoadLevel("Minigra");and with SceneManager.LoadScene ("OtherSceneName", LoadSceneMode.Additive);. And it’s all the same. Can you help me? There is my code:

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

public class Controller : MonoBehaviour {
    public GUIText scoreText;
    public int score;
    public GUIText restartText;
    public GUIText gameOverText;
    public GUIText countTargetText;

    public GameObject target;
    private float nextDrop = 0f;
    private float dropInterval = 2f;
    private float changeInterval = 5f;

    private bool gameOver;
       
    GameObject[] countTarget;

    void Start()
    {
        score = 0;
        UpdateScore();
        gameOver = false;
        UpdateScore();
        restartText.text = "";
        gameOverText.text = "";
        countTargetText.text = "0/10";
        InvokeRepeating("Target", 1, nextDrop);


    }

    void Target()
    {
        float x = Random.Range(-26f, 26f);
        float z = Random.Range(-22f, 27f);
        Instantiate(target, new Vector3(x, 0, z), Quaternion.identity);
    }

    void Update()
    {
        if (Time.time >= nextDrop) //If ready to spawn
        {
            Target();
            nextDrop += dropInterval; //Set next spawn time
            if (Time.time >= changeInterval) //If ready to change spawn interval
            {
                if (dropInterval > 0.5f) //Change spawn interval to 3/4ths what it was
                    dropInterval *= 0.80f;
                else //Make sure dropInterval stays above 1.
                    dropInterval = 0.5f;
            }
        }

        countTarget = GameObject.FindGameObjectsWithTag("Target");
        countTargetText.text = countTarget.Length + "/10";

        
            
        

        if (countTarget.Length >= 10)
        {
            gameOverText.text = "Game Over!";
            gameOver = true;
        }
        if (gameOver)
        {
            restartText.text = "Naciśnij R żeby zrestartować";
            if (Input.GetKeyDown(KeyCode.R))
            {
                SceneManager.LoadScene("Minigra");
                Destroy(GameObject.FindWithTag("Target"));
                gameOver = false;
            }
        }
    }

    public void AddScore(int newScoreValue)
    {
        score += newScoreValue;
        UpdateScore();
    }


    void UpdateScore()
    {
        scoreText.text = "Punkty: " + score;
    }

}

You could try

SceneManager.LoadScene ("OtherSceneName", LoadSceneMode.Single);

Also i would advise to reorganize as the code after “LoadScene” should not execute.

Destroy(GameObject.FindWithTag("Target"));
gameOver = false;
SceneManager.LoadScene ("OtherSceneName", LoadSceneMode.Single);

Keep in mind that objects tagged with DontDestroyOnLoad(Object) wont get destroyed

I think somethng serious is wrong with this code but I still don’t know what. I add
’ if (countTarget.Length >= 10)
{
gameOverText.text = “Game Over!”;
gameOver = true;
CancelInvoke(); ’

And text “Game over” is displayed properly but Invoike is still going. Also whan I want to restar it’s not working.

Any clue what I’m doing wrong?