Hi, I am having an issue where I want to have a door open on a specific date, at a specific time. But I keep getting errors such as ‘attempt to compare booleen’ and ‘attempt to compare booleen and number’, I have tried formatting it in the ways below.
--Attempt 1
while true do
-- Locals
local now = os.time()
local Day = os.date("*t",now)["day"]
local Month = os.date("*t",now)["month"]
local Year = os.date("*t",now)["year"]
local Hours = os.date("*t",now)["hour"]
local Mins = os.date("*t",now)["min"]
local Secs = os.date("*t",now)["sec"]
local num1 = Day == 18 and Month == 04 and Year == 2021 and Hours == 00 and Mins == 48 and Secs == 00
local num2 = Day == 18 and Month == 04 and Year == 2021 and Hours == 00 and Mins == 49 and Secs == 00
-- Wait 1 Second
wait(1)
--Print the result
print(Hours .. ":" .. Mins .. ":" .. Secs)
--Checks if it is witin the time specified
if num1 <= num2 then
--It is, it makes it so you can walk through
script.Parent.CanCollide = false
else
script.Parent.CanCollide = true
end
end
--Atempt 2
while true do
-- Locals
local now = os.time()
local Day = os.date("*t",now)["day"]
local Month = os.date("*t",now)["month"]
local Year = os.date("*t",now)["year"]
local Hours = os.date("*t",now)["hour"]
local Mins = os.date("*t",now)["min"]
local Secs = os.date("*t",now)["sec"]
-- Wait 1 Second
wait(1)
--Print the result
print(Hours .. ":" .. Mins .. ":" .. Secs)
--Checks if it is witin the time specified
if Day == 18 and Month == 04 and Year == 2021 and Hours == 00 and Mins == 53 and Secs == 00 <= Day == 18 and Month == 04 and Year == 2021 and Hours == 00 and Mins == 54 and Secs == 00 then
--It is, it makes it so you can walk through
script.Parent.CanCollide = false
else
script.Parent.CanCollide = true
end
end