Time up and go to score summary page

What to do when time runs out, go to the score summary page.
This is the code I wrote about the time.

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

public class Timer : MonoBehaviour
{
    public Slider timerSlider;
    public Text timerText;
    public float gameTime;

    private bool stopTimer;

    void Start()
    {
        stopTimer = false;
        timerSlider.maxValue = gameTime;
        timerSlider.value = gameTime;
    }

    void Update()
    {
        float time = gameTime - Time.time;
        int minutes = Mathf.FloorToInt(time / 60);
        int seconds = Mathf.FloorToInt(time - minutes * 60f);
        string textTime = string.Format("{0:0}:{1:00}", minutes, seconds);

        if ( time <= 0)
        {
            stopTimer = true;
        }

        if ( stopTimer == false)
        {
            timerText.text = textTime;
            timerSlider.value = time;
        }

        if(secondsToShow > maxTime) 
        { 
            LoadScene(loseScene); 
        }
    }
}

Your code has some errors, like the float time being reset every frame, so it never counts down to zero.

You can change that line for: float time = gameTime - Time.time;

For loading a scene, you will need a string with the name of the scene you want to load.
Example: SceneManager.LoadScene("NameOfScene");.
The scene you want to load must be in: File > Build Settings > Scenes in Build, if it isn’t, then you have to drag a scene to the list, or click Add Open Scenes (adds the scenes that are open in the moment).

Hope this works or helps :smiley: