- Home /
How to reset scoreboard on death - help please
So i have a script that shows a box on the screen with the current points the player got. The player is a ball and when the player collide with a coin it dissapears and the player gets a point on the scoreboard.
Now, my problem is that when the player dies his scoreboard just continues, anyone who can help me?
My current script looks like this:
pragma strict
static var currentScore : int = 0;
var offsetY : float = 40; var sizeX : float = 100; var sizeY : float = 40; var maxFallDistance = -10;
function OnGUI () { GUI.Box (new Rect (Screen.width/2-sizeX/2, offsetY, sizeX, sizeY), "Score: " + currentScore); }
but then i tried to add this to it, but it didn´t work, why?:
if (transform.position.y <= maxFallDistance)
{
Reset(currentScore);
}
Please format your code. If you don't know how, watch the tutorial video on the right.
Your answer
![](https://koobas.hobune.stream/wayback/20220613130103im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Animation spins wildly after completed 0 Answers
hide object start script 4 Answers
Flashlight Blink? 1 Answer