why is this adding another second after every second it counts down?
local DataCache = require(game.ServerScriptService.DataCache)
local function updateBoostDuration(player)
local Data = DataCache.GetDataFrom(player)
if Data.Boosts.MoreRuneLuck.StartTime and Data.Boosts.MoreRuneLuck.Duration > 0 then
local currentTime = os.time()
local elapsedTime = currentTime - Data.Boosts.MoreRuneLuck.StartTime
if elapsedTime >= Data.Boosts.MoreRuneLuck.Duration then
print(player.Name .. " has no more boosts.")
Data.Boosts.MoreRuneLuck.Duration = 0
else
Data.Boosts.MoreRuneLuck.Duration = Data.Boosts.MoreRuneLuck.Duration - 1
end
player.Data.Boosts.MoreRuneLuck.Duration.Value = Data.Boosts.MoreRuneLuck.Duration
end
end
game.Players.PlayerAdded:Connect(function(player)
wait(8)
local Data = DataCache.GetDataFrom(player)
Data.Boosts.MoreRuneLuck.StartTime = os.time()
while true do
updateBoostDuration(player)
task.wait(1)
end
end)```