I have a leaderstats named TimePlayed, but it does not save

How can I save my leaderstats named TimePlayed so that when a player leaves a game and rejoins, the TimePlayed shows the same value?

You could use DataStoreService and save the value of the TimePlayed thing whenever a player leaves the game and load it again whenever a player joins the game.