HIGHSCORE Problem Help

Hi, im really new with unity and javascript and I have a Problem with my Scoring system,
whenever i get game over the score leaderboard is normal, but when I finish all stage on my game… the score from 1st to 5th is same as high score.

i dunno what i must do, here is the pict

if i get game over the score is normal

if I clared all stage in my game the score error like this

here is my script Skor.js

//static var score : int;
static var score : float = Time.timeSinceLevelLoad;
var guiScore : GUIText;
static var teks = false;
static var reset = false; // fungsi reset
static var HScore = false;

function Start() 
{
	//Skor dari stage lama dibawa ke stage baru
	guiScore.text = "Score: " + score;
}

function LateUpdate()
{
	if(teks)
	{	
		guiScore.text = "Score: " + score;
		teks = false;
	}
	
	if(reset) // mereset score ulang
	{
		guiScore.text = "Score: 0";
		score = 0;
		reset = false;
	}
	
	if(HScore)
	{
		if( score > PlayerPrefs.GetFloat("wormScore1"))
		{
			PlayerPrefs.SetFloat("wormScore5", PlayerPrefs.GetFloat("wormScore4"));
			PlayerPrefs.SetFloat("wormScore4", PlayerPrefs.GetFloat("wormScore3"));
			PlayerPrefs.SetFloat("wormScore3", PlayerPrefs.GetFloat("wormScore2"));
			PlayerPrefs.SetFloat("wormScore2", PlayerPrefs.GetFloat("wormScore1"));
			PlayerPrefs.SetFloat("wormScore1", score);
		}
		else if( score > PlayerPrefs.GetFloat("wormScore2"))
		{
			PlayerPrefs.SetFloat("wormScore5", PlayerPrefs.GetFloat("wormScore4"));
			PlayerPrefs.SetFloat("wormScore4", PlayerPrefs.GetFloat("wormScore3"));
			PlayerPrefs.SetFloat("wormScore3", PlayerPrefs.GetFloat("wormScore2"));
			PlayerPrefs.SetFloat("wormScore2", score);
		}
		else if( score > PlayerPrefs.GetFloat("wormScore3"))
		{
			PlayerPrefs.SetFloat("wormScore5", PlayerPrefs.GetFloat("wormScore4"));
			PlayerPrefs.SetFloat("wormScore4", PlayerPrefs.GetFloat("wormScore3"));
			PlayerPrefs.SetFloat("wormScore3", score);
		}
		else if( score > PlayerPrefs.GetFloat("wormScore4"))
		{
			PlayerPrefs.SetFloat("wormScore5", PlayerPrefs.GetFloat("wormScore4"));
			PlayerPrefs.SetFloat("wormScore4", score);
		}
		else if( score > PlayerPrefs.GetFloat("wormScore5"))
		{
			PlayerPrefs.SetFloat("wormScore5", score);
		}
		HScore = false;
	}
}

and here is my PindahLevel.js

var guiWIN : GUIText;
var moveStage2 = false;
var moveStage3 = false;
var tamat = false;


function Update()
{
	CheckForEnemies();
}

function CheckForEnemies()
{
	if (moveStage2)
	{
    if (GameObject.FindWithTag("enemy") == null)
		{	
			Nyawa.HITS = 0;
			guiWIN.text = "STAGE 1 CLEAR";
			yield WaitForSeconds(5);
			Application.LoadLevel("Story2");
		}
	}
	
	if (moveStage3)
	{
    if (GameObject.FindWithTag("enemy") == null)
		{	
			Nyawa.HITS = 0;
			guiWIN.text = "STAGE 2 CLEAR";
			yield WaitForSeconds(5);
			Application.LoadLevel("Story3");
		}
	}
	
	if (tamat)
	{
    if (GameObject.FindWithTag("enemy") == null)
		{	
			Skor.HScore = true; // This is when all stage cleared score save it.
			Nyawa.HITS = 0;
			guiWIN.text = "STAGE 3 CLEAR";
			yield WaitForSeconds(5);
			Application.LoadLevel("MenuUtama");
		}
	}
}

i hope anybody can help me with my problem… :frowning:

No real answer to you problem, but alternatively you could just store the scores exactly as they are in each worms playerpref without sorting them as i expect the error to be there (no if (worm1score > worm2score), just worm1score = playerprefs(worm1score) //pseudocode).
And only if you read out the variables, read them into a list and do List.Sort() maybe with linQ by score. From there you can use them as usual.
class wormscore{
int wormid;
int score;
}

@ValooFX

so i just replace > to = on every score > playerperfs?
but it wont make oldscore replace by highscore.

and plus i get an error.

i search everything and still stuck…
this scoring system make my brain explode. :frowning:

You would save all highscores:

if (wormscore1 > PlayerPrefs.GetInt(“wormscore1”)) {
PlayerPrefs.SetInt(“wormScore1”, wormscore1);
}
if (wormscore2 > PlayerPrefs.GetInt(“wormscore2”)) {
PlayerPrefs.SetInt(“wormScore2”, wormscore2);
}
and so on…

You would read them:

using system.linq;

public class Wormscore {
public int wormNumber;
public int score;
public Wormscore(int _worm, int _score){worm=_worm;score=_score);}
}

List GetOrderedScores() {
List scores = new List();
for (int i=0;i<5;i++) { //if 5 worms
scores.Add(new Wormscore(i,PlayerPrefs.GetInt(“wormscore”+i.ToString)));
}
scores = scores.OrderByDescending(x => x.score).ToList();
return scores;
}

i typed that out of my head, there will be errors you have to fix and things to put in context.

hmm… i already used and ask that like in this unity ask High Score not saving problem - Questions & Answers - Unity Discussions
its still cant save highscore, wont save highscore at all…

at last i already fix this score problem
the problem is because i put Skor.HScore = true; on PindahLevel.js script…
i think thats script make score save 5 times…
because i test add sound and put it on PindahLevel.js Script the sound play like 5 times at same time…

maybe there is some alternative better script for my PindahLevel.js Script?