how to reset score in game over restart button?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;

public class ScoreManager : MonoBehaviour
{
    public TextMeshProUGUI Coins_value_textholder;
    public static int score = 0;

    public TextMeshProUGUI FinalScore_Textholder;

    // Update is called once per frame
    void Update()
    {
        Coins_value_textholder.text = score.ToString();
        FinalScore_Textholder.text = score.ToString();
    }
    
    
}

Hey @lvoltia61

Updating your score and coins using update is a very inefficient way to handle it. The process will be called every frame, even when coins are not collected or score is not increasing.

I recommend using dedicated functions to update the score and coins only when they need to.

For example;

public class ScoreManager : MonoBehaviour
 {
     public TextMeshProUGUI Coins_value_textholder;
	 public TextMeshProUGUI FinalScore_Textholder;
     public static int score;
	 int coins();
 
     void Start()
	 {
	 	score = 0;
	 }
 
     // Update is called once per frame
     void Update()
     {
                  
     }
     
	 public void UpdateScore(int _value)
	 {
	 	score += _value;
		FinalScore_Textholder.text = score.ToString();
		
	 }
	 
	 public void CollectCoins()
	 {
	 	coins++;
		Coins_value_textholder.text = coins.ToString();
	 }
     
 public void GameOver()
 {
 	//present a game over UI
	score = 0;
	coins = 0;	
 }
 }

Then when a coin is collected or score is increased by killing an enemy, just call the functions as required.
Additionally, on the game over event, you just call the GameOver function which should have the code to handle the reset