crate109
|
  |
| Joined: 24 Nov 2010 |
| Total Posts: 315 |
|
|
| 06 Feb 2014 09:29 AM |
What would be the script to turn on and turn off a Torch using Spotlight? So when night comes, it turns on and when day comes it turns off?
I tried: if game.Lighting.TimeOfDay == "07:00:00" then script.Parent.Enabled = false -------The script is in the Spotlight elseif game.Lighting.TimeOfDay == "18:00:00" then script.Parent.Enabled = true end
Tkx. |
|
|
| Report Abuse |
|
|
crate109
|
  |
| Joined: 24 Nov 2010 |
| Total Posts: 315 |
|
|
| 06 Feb 2014 09:30 AM |
| I forgot to say that the thing I tried isn't working. |
|
|
| Report Abuse |
|
|
Hibobb
|
  |
| Joined: 18 Apr 2010 |
| Total Posts: 2146 |
|
|
| 06 Feb 2014 09:33 AM |
You would have to use minutesaftermidnight.
if game.Lighting:GetMinutesAfterMidnight() == 420 then script.Parent.Enabled = false -------The script is in the Spotlight elseif game.Lighting:GetMinutesAfterMidnight() == 1080 then script.Parent.Enabled = true end |
|
|
| Report Abuse |
|
|
crate109
|
  |
| Joined: 24 Nov 2010 |
| Total Posts: 315 |
|
|
| 06 Feb 2014 09:41 AM |
| I see. Well it doesn't work :x I will try to work on it. Thank you |
|
|
| Report Abuse |
|
|
crate109
|
  |
| Joined: 24 Nov 2010 |
| Total Posts: 315 |
|
|
| 06 Feb 2014 06:48 PM |
| I don't know what is the problem... I tried to make the part transparent instead of the Spotlight enabled, and it worked, but it doesn't work for the Spotlight. |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 06 Feb 2014 06:55 PM |
| Why doesn't TimeOfDay work anymore? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 06 Feb 2014 07:01 PM |
| because it probably never is EXACTLY that amount of mins past midnight, as if the script that is making is go ahead in time is not making it go to exactly that #, use gtr and lss |
|
|
| Report Abuse |
|
|
crate109
|
  |
| Joined: 24 Nov 2010 |
| Total Posts: 315 |
|
|
| 06 Feb 2014 09:09 PM |
| So we should always use Int values instead of String values? (Numbers instead of Characters) |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 09:34 PM |
| Is it checking every (what so ever) seconds/minutes? or is that code triggered only once and never runned again? |
|
|
| Report Abuse |
|
|
crate109
|
  |
| Joined: 24 Nov 2010 |
| Total Posts: 315 |
|
|
| 06 Feb 2014 09:54 PM |
| In my case, lights shut down at 7:00:00 (works once) and should turn on at 18:00:00 (Doesn't work at all) |
|
|
| Report Abuse |
|
|