|
| 15 Jul 2015 06:15 PM |
I'm trying to make the lights turn on/off at a certain time of day in Roblox. I have two scripts, one changes the time of day and I have one checking to see what time it is.
TOD Changer:
l = game:service("Lighting") while true do wait(0.1) l:SetMinutesAfterMidnight(l:GetMinutesAfterMidnight() +0.1) --almost one minute every second. end
Checker:
l = game:service("Lighting") currentTime = l:GetMinutesAfterMidnight() local light = game.Workspace.LampPost1.Light.Light
while true do wait(.1) print(currentTime) end
However, the check script will just keep printing the same time over and over again, I assume it's the time it starts on. Help? |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2015 06:18 PM |
The reason is because, you declared currentTime out of the loop, thus it'll stay at a constant value
to fix this, define it in the loop
l = game:service("Lighting") local light = game.Workspace.LampPost1.Light.Light
while true do wait(.1) currentTime = l:GetMinutesAfterMidnight() print(currentTime) end
-Baheeg |
|
|
| Report Abuse |
|
|
| |
|