Running code at the same time EST everyday

Hey so I currently have a piece of code referenced from another topic, and although it works perfectly in trying to find the current time and printing, I would like for it to continue to print for any time from 7:00PM to 8:00PM. I’m unsure of how to go about this, so any sort of direction would help! Thanks in advance.

Code:
		local UTCSeconds = os.time()

		local ESTSeconds = UTCSeconds - (SecondsInHour * 4)
		local ESTDate = os.date("!*t", ESTSeconds)

		local hourString = tostring(ESTDate.hour > 12 and ESTDate.hour % 12 or ESTDate.hour)
		local minuteString = ESTDate.min < 10 and "0"..ESTDate.min or tostring(ESTDate.min)
		local period = ESTDate.hour > 12 and "PM" or "AM"

		if (hourString..":"..minuteString.." "..period) == "7:00 PM" then
			print("ez! :)")
		end
2 Likes

It will be something like this:

if hourString == "7" and period == "PM" then
	print("ez! :)")
end

It will work from 7:00PM to 7:59PM (7:59PM last print)

local currentHour = os.date("%H")
print(currentHour)
currentHour = tonumber(currentHour)
if currentHour >= 19 and currentHour <= 20 then
	print("The time is currently between 7PM and 8PM!")
end

You really don’t need all that code for this.

https://developer.roblox.com/en-us/api-reference/lua-docs/os

1 Like

Thanks so much! I wasn’t aware.