How do i reset a value at the end of every week

Hey there,

I am currently creating a system in game that shows your total and weekly time.

So my question is: How do i create a system that would completely reset a players leaderstats value at the end of each week?

For Example:

game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local totalTime = Instance.new("IntValue")
totalTime.Name = "Total Time Played"
totalTime.Parent = leaderstats

local weeklyTime = Instance.new("IntValue") -- I want this value to be reset at the end of each week
weeklyTime.Name = "Weekly Time Played"
weeklyTime.Parent = leaderstats
end)

Is this currently possible to do?

Thanks! :slight_smile:

You could use os.time and check if the value needs to reset once the player joins.

1 Like