function saveScore(score) {
    fetch('Score.php', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        body: 'score=' + encodeURIComponent(score)
    })
    .then(response => response.json())
    .then(data => {
        if (data.status === "success") {
            console.log("Score saved successfully");
        } else {
            console.log("Failed to save score:", data.message);
        }
    })
    .catch(error => console.error("Error API:", error));
}