How to fire a function when it reaches a certain date?

Salutations! I was wondering how do you fire a function upon a certain date. I would like to fire a function upon Christmas Eve, and Christmas for my new upcoming game. I’m not sure how to do this, though! I would like some help!!

1 Like

You can use os.time, the API here: os | Documentation - Roblox Creator Hub

local triggerChirstmasEvent = os.time {month = 12; day = 25; year = 2020}
local isChristmasEve = false 
while true do
    if os.time() >= christmasTrigger then
        isChristmasEve  = true
        wait()
        break
    end
    wait()
end

if isChristmasEve == true then 
-- start the event, etc.
end

You can duplicate this for the Christmas event.

3 Likes

Hello, @stqrrydev! How do I mark the post as solved, as you have solved my problem!

There is a grey “Solution” text at the bottom of my message, with a checkmark box beside it.
Happy I helped! :grinning:
Screen Shot 2020-12-23 at 11.36.48 AM

Oh, I don’t see it! :frowning:,

Maybe because it’s in Help and Feedback > Cool Creations. Maybe you can ping (message) a Community Editor or a Mod (staff) to move it to something like #help-and-feedback:scripting-support.