Changing a value in a table every second, and making it disappear after the countdown ends

I have a playerData.ActiveBoosts table. Every time a boost is activated, a value is created like so:

image

I’ve made a script that makes the value go down every second, and the value disappears after it hits 0. The only downside is that the timers do not go down until both of the boosts are active.

Here’s my code below:

if you are trying to make a timing system for Boosts you could do something like this:

local activeBoosts = {}

local endTime = os.time() + 100 -- cooldown of 100s as example
activeBoosts["Boost"] = endTime
task.delay(100,function()
	activeBoosts["Boost"] = nil
end)

while the Boost is active you can find the time remaining time on it by doing activeBoosts[Boost] - os.time()
To check if a boost is active, you can do

if activeBoosts[boostName] then
end