How to add points to score using GetComponent

My sceneManagers score doesn’t get updated until after I stop playing. It’s not so much that I can’t find a way to get the result I wan’t as I probably could using static variables, it’s more about learning why it doesn’t get updated in game and how to achieve this using GetComponent. The OnTriggerEnter is detected and everything, the only problem I have is that the score doesn"t get updated while the game is running. When I stop the game and hit play again suddenly the score is no longer 0 and it reflects how many points I scored in my last playthrough, and it’ll keep adding like this on and on. I can simply make score = 0 at start, that’s an easy fix, but I just typed this to show that the points are getting scored.

This is on my players script

function OnTriggerEnter2D(other : Collider2D)
{
    if(other.tag == "Score")
    {
        sceneManager.GetComponent(SceneManagerScriptX).score += 1;
    }

This is my sceneManagers script

#pragma strict
var alive : boolean = true;
var score : int = 0;
  
function OnGUI()
{
	GUI.Label(Rect(100,100,100,100), "score" + score);
}

Update: Cleaned the code up a bit.

PlayerPrefs is meant for writing persistent data to disk, and should only be used once when appropriate, not every frame in Update. There’s no reason to use Update here at all; it should be avoided where possible and only used for things that really need to happen every frame. You can make a function for scoring that only runs when the score changes. Use a variable for the top score which is read from PlayerPrefs in Start/Awake.

just place the script in a gameobject in the scene, and acess then like this :

    if(other.tag == "Score")
    {
var scripting : NameOfTheScriptToAcess = yourobjectwithscript.GetComponent(NameOfTheScriptToAcess);
scripting.score += 1;
    Destroy(other);

    }