I've got a function in my script so that when (below) is true, it will trigger the loop.
1 | 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
01 | while true do |
02 | local minutes = game.Lighting:GetMinutesAfterMidnight() |
03 |
04 | if minutes > = 420 or minutes < = 1260 then |
05 | --Do stuff here |
06 | else |
07 | --Do something else here. |
08 | end |
09 |
10 | wait() |
11 | end |