SecondsKey = "SecondsPlayed" game.Players.PlayerAdded:connect(function(player) player:WaitForDataReady() leaderstats = Instance.new("IntValue") leaderstats.Parent = player leaderstats.Name = "leaderstats" SecondsPlayed = Instance.new("IntValue") SecondsPlayed.Parent = leaderstats SecondsPlayed.Name = "Seconds Played" SecondsPlayed.Value = 0 while wait(1) do SecondsPlayed.Value = SecondsPlayed.Value +1 end SecondsPlayed.Value = player:LoadNumber(SecondsKey) end) game.Players.PlayerRemoving:connect(function(player) player:SaveNumber(SecondsKey, player.leadrstats.SecondsPlayed.Value) end)
The saving doesn't work when I rejoin, I also shutdown all servers and rejoined. It still didn't work.