Days, Hours, Minutes Timer

I want to make a timer that can track the amount of days, hours and minutes you have an effect for EXAMPLE: you type in a code and the code gives you 2x speed for 1 day and 10 hours, I want to make a timer that can show the amount of time you have left, any help would be amazing thanks :kissing_heart:

1 Like

you can set a datastore timer to os.time() when the player is rewarded

and check the current os:time() every second (present how long left) and if the difference is over 122,400 (34 hours) the effect doesnt work

Well the timer only goes down when the player is in game, that would be in and out of game

local start = os.time()

while true do
    if os.time - start > x then
        -- remove effect
    end
end

Where x is the duration of the effect.

2 Likes

Datastore the time the player has the item for, in seconds. When a player joins the game you just simply want to add time to another value that you will save as the time the play has already had the item for, compare if the first value is greater than the second, if so they can still have the item.

if player.Removed then
(pause timer script idk what it is tho)
end

I believe you meant

game.Players.PlayerRemoving:Connect(function(Player)

end)
1 Like

Your guys realize how this is not going to work, I’m only wanting the time to go down when the player is in game, when comparing the time with os.time thats irl time

I’m completely aware, that’s why nowhere in my solution did I mention os.time

Re-read my reply carefully and you’ll see it’s a valid solution.

(If you need me to clarify something, there might be some bad wording in the reply, just let me know)

yea im not a scripter i tried to remember off the top of my head

1 Like