Hey, I am new to game development, and I can't understand how to script to keep the score value unchanged when the current scene is reloaded. Can you tell me how to do that?

I tried playepref, didn’t work

There are several kinds of “scores” to keep track. I assume you are talking about the simpler one, like a score of a single gameplay, and it resets for the next match.

You need to use an objec take persists through scenes. In order to do take, you use the DontDestroyOnLoad method.

Keep the score in a variable on a script in this object that will not be destroyed after a scene is unloaded.
There are other issues here, you need to be sure that you don’t create two of the same persistent object. Also, “reloading” does not mean restart the game. For that, it is a whole other story.