I have a script in place and it’s connected to game.Lighting:GetPropertyChangedSignal("ClockTime") event, the thing is when I’m comparing ClockTime it’s like it does not work.
I have it like this;
local function GetClockTime()
return math.floor(LightingService.ClockTime)
end
if GetClockTime() >= 20 and GetClockTime() <= 6 then
-- script runs
end
The thing is, the script never runs unless I put or and I’m confused because you’d think it’d work as expected since it’s giving the actual numbers and the ClockTime event would work like 20/21/22/23/0/1/2/3/4/5 since those numbers are less than six.
If you really think about it, how would you get a number which is greater than 20 but also less than 6?
It makes sense semantically (since this has to do with time), but not logically (since a number cant be greater than 20 and less than 6 at the same time)
You need to use the or operator instead of and
Yeah and I’ve done that and it causes errors because after the ClockTime hits 6 or like passes six then it keeps spamming the script that’s supposed to execute if ClockTime == 6 and if ClockTime >= 20.
Yes but the point is if I do that then the script will fire either way, it keeps happening in studio when I test it so will the way I put above work or not?