So I'm making an AFK game and I have the script working:
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local secs = Instance.new("IntValue")
secs.Name = "Time Played"
secs.Value = 0
secs.Parent = stats
stats.Parent = newPlayer
while true do
wait(1)
secs.Value = secs.Value + 1
end
end
game.Players.ChildAdded:connect(onPlayerEntered)
But somehow I can't figure out how to store it, anyone can tell me how or why?

1 comment
You can just save the data once the player leaves the game. Also use this dev forum page: https://developer.roblox.com/en-us/articles/Data-store