A small game component that, every update tick, writes the current high score to a sandboxed leaderboard service using Sandbox.Services.Stats.SetValue with the key "HighScoreLeaderboard" and ScoreManager.HighScore.
using Sandbox;
using System;
using System.Threading.Tasks;
public sealed class Hsmanager : Component
{
protected override void OnUpdate()
{
WriteToLeaderboard();
}
public static void WriteToLeaderboard()
{
Sandbox.Services.Stats.SetValue( "HighScoreLeaderboard", ScoreManager.HighScore );
}
}