I've got a function in my script so that when (below) is true, it will trigger the loop.
while game.Lighting.TimeOfDay > 070000 and game.Lighting.TimeOfDay < 210000 do
The only problem is that my example doesn't work. The Output is telling me "attempt to compare number with string" So how am I supposed to check the TimeOfDay value within a script?
Midnight is considered "00:00:00" In roblox's time format. So 07:00:00 will be 420
and 21:00:00 is considered to be 1260
. And as this is within a while true do
statement, It will run for as long as the script exists, All you have to do is code what you want to happen between these times
while true do local minutes = game.Lighting:GetMinutesAfterMidnight() if minutes >= 420 or minutes <= 1260 then --Do stuff here else --Do something else here. end wait() end