how to make score number run

Well, if you’ve played flappy bird. You’ll probably notice that after you die the score will run from 0->your point. Is there anyway that i can put it in my game using C# script?

I am doing something similar with my project. My solution (might not be best) was to create a trigger zone. I created a cube, and stretched it out so it was like a finishing line. Click the isTrigger checkbox so that you don’t see or collide into it. Attach a script to your zone, and use the OnTriggerExit to set your score. So far for me it has been working flawlessly.

If each pipe is set up to spawn at x: 1,2,3, ect. Then you would want to get the position of the bird object when it dies.

void OnDestroy() {
   int score = transform.position.x;