Having trouble with adding a save to a game i am making in Javascript

I am trying to make a Cookie Clicker clone in javascript. I tried to add a save function to it using localStorage. For some reason when i run it the score variable gets decreased by 100.

let scoreText = document.getElementById("scoreText");
let biscuitButton = document.querySelector("#biscuitButton");
let resetButton = document.getElementById("resetButton");
let buyAutoClicker = document.getElementById("buyAutoClicker");
let amountOfAutoClickersText = document.getElementById("amountOfAutoClickersText");
let pageTitle = document.getElementById("pageTitle");
let cookieImage = document.getElementById("cookiePicture");
let autoClickerPrice = 100;
let autoClickerPriceText = document.getElementById("autoClickerPrice");
let saveButton = document.getElementById("saveButton");
let loadSaveButton = document.getElementById("loadSaveButton");
let score = 0;
let amountOfAutoClickers = 0;
let canClick = true;
localStorage.setItem("savedAutoClickerPrice", 100);
console.log("Made by irelephant@calckey.world\nIdea from cookie clicker by orteil \nCheated biscuits taste bad.")

biscuitButton.onclick = function() {
  if (canClick) {
    score++;
    scoreText.innerText = score;
    pageTitle.innerText = score + " Biscuits - biscuit tapper";
    canClick = false;
    setTimeout( function() {
        cookieImage.src = "cookie.png";
        cookieImage.height = "200";
        cookieImage.width = "200";
    }, 100);
    cookieImage.src = "cookieDark.png";
    cookieImage.height = "190";
    cookieImage.width = "190";
    setTimeout( function() {
        canClick = true;
    }, 250);
    }
  }


resetButton.onclick = function() {
    score = 0;
    amountOfAutoClickers = 0;
    scoreText.innerText = score;
    amountOfAutoClickersText.innerText = amountOfAutoClickers;

}
buyAutoClicker.onclick = buyAutoClick;

saveButton.onclick = function() {
    localStorage.setItem("savedScore", score);
    localStorage.setItem("savedAutoClickers", amountOfAutoClickers);
    localStorage.setItem("savedAutoClickerPrice", autoClickerPrice);
}
loadSaveButton.onclick = function() {
    score = localStorage.getItem("savedScore");
    scoreText.innerText = score;
    amountOfAutoClickers = localStorage.getItem("savedAutoClickers");
    amountOfAutoClickersText.innerText = amountOfAutoClickers;
    autoClickerPrice = localStorage.getItem("savedAutoClickerPrice");
    autoClickerPriceText.innerText = autoClickerPrice;
    if (amountOfAutoClickers != 0) {
        amountOfAutoClickers -= 1;
    }
    buyAutoClick()
    
}



function buyAutoClick() {
    {
        if (score >= autoClickerPrice) {
            score -= autoClickerPrice;
            scoreText.innerText = score;
            amountOfAutoClickers++;
            autoClickerPrice++;
            amountOfAutoClickersText.innerText = amountOfAutoClickers;
            autoClickerPriceText.innerText = autoClickerPrice;
            setInterval(autoClick, 4000);
        }
    
        

    }
}
function autoClick() {
    
    scoreText.innerText = score;    
    score += amountOfAutoClickers;
    scoreText.innerText = score;
    
} 

This is the HTML if it is needed:

<!DOCTYPE html>
<html>
    <head lang="en">
        <link rel="stylesheet" href="styles.css">
        <meta charset="utf-8">
        <title id="pageTitle">0 Biscuits - Biscuit tapper</title>
    </head>
    <body>
        <div id="container">
            <div id="Bar">
                <p class="scoreWords">Score: <strong><span id="scoreText">0</span></strong></p>
                <p class="scoreWords">Auto Clickers: <strong><span id="amountOfAutoClickersText">0</span></strong></p>
                <button id="resetButton">Reset</button>
                <button id="clearSave">Clear Save</button>
                <button id="saveButton">Save</button>
                <button id="loadSaveButton">Load Save</button>
                <button id="buyAutoClicker">Buy auto clicker (<span id="autoClickerPrice">100</span>)</button>
            </div>
            <div id="actualClickyThing">
        	    <button id="biscuitButton"><img src="cookie.png" width="200" height="200" alt="A biscuit. Tap to play the game" id="cookiePicture"></button>
            </div>
        </div>
        <script src="index.js"></script>
    </body>
</html>

Any help is appreciated.

I just realised my mistake as soon as i posted it :sweat_smile: .
The buyAutoClicker() function would decrement the score by 100 every time it is ran, and it is ran when the save is fetched.