I tried using save storage for the first time but sadly it wont save the data at all
local DataStore = game:GetService("DataStoreService"):GetDataStore("Time") game.Players.PlayerAdded:connect(function(player) local stats = Instance.new("Model", player) stats.Name = "leaderstats" local seconds = Instance.new("IntValue", player.leaderstats) seconds.Name = "Seconds" local minutes = Instance.new("IntValue", player.leaderstats) minutes.Name = "Minutes" local hours = Instance.new("IntValue", player.leaderstats) hours.Name = "Hours" -- local key = "player-"..player.userId local savedV = DataStore:GetAsynt(key) if savedV then -- {seconds, minutes, hours} seconds.Value = savedV[1] minutes.Value = savedV[2] hours.Value = savedV[3] else local valuesToSave = {seconds.Value, minutes.Value, hours.Value} DataStore:SetAsync(key, valuesToSave) end end)
leave script
local DataStore = game:GetService("DataStoreService"):GetDataStore("Time") game.Players.PlayerRemoving:connect(function(player) local key = "player-"..player.userId local valuesToSave = {player.leaderstats.seconds.Value, player.leaderstats.minutes.Value, player.leaderstats.hours.Value} DataStore:SetAsync(key, valuesToSave) end)
I also did this
local DataStore = game:GetService("DataStoreService"):GetDataStore("Time") game.Players.PlayerRemoving:connect(function(player) local key = "player-"..player.userId local valuesToSave = {player.leaderstats.seconds.Value, player.leaderstats.minutes.Value, player.leaderstats.hours.Value} DataStore:SetAsync(key, valuesToSave) end)