|
| 01 Feb 2014 03:27 PM |
I'm making a light that works in accordance to what time it is in-game, I.E. the light will turn on at night. I'm a n00b scripter and it's been a long time since I've been on ROBLOX so any help is greatly appreciated, thanks.
if game.Lighting.TimeOfDay > "20:00:00" or game.Lighting.TimeofDay < "8:00:00" then script.Parent.SpotLight.Brightness = 10 end |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 03:29 PM |
while wait() do if game.Lighting.TimeOfDay > "20:00:00" or game.Lighting.TimeofDay < "8:00:00" then script.Parent.SpotLight.Brightness = 10 else script.Parent.SpotLight.Brightness = 0 end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Feb 2014 03:34 PM |
| Actually, after testing, that still doesn't work :T |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 03:42 PM |
Actually, look at the if statement
the first time it says TimeOfDay the second time it is TimeofDay |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 03:45 PM |
Oof! I'm always doing things like that! o: Thanks, man. |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 03:52 PM |
| Hmm, it turns on now, but it never turns back off, oddly... |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 01 Feb 2014 04:21 PM |
You never turned it off anywhere in the script, so why would it turn off?
use "else"
else light.Enabled = false |
|
|
| Report Abuse |
|
|
| |
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 01 Feb 2014 04:32 PM |
| Oh, didn't see that. Try just disabling it. |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 06:47 PM |
| No, that still doesn't work. |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 06:54 PM |
| You can't compare strings with the numerical comparison operators (<, <=, >, >=) in Lua. You're gonna have to use the Lighting::GetMinutesAfterMidnight method and compare THOSE values. |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 08:07 PM |
I tried,
while wait() do if game.Lighting:GetMinutesAfterMidnight() > 1200 or game.Lighting.GetMinutesAfterMidnight() < 480 then script.Parent.SpotLight.Enabled = true else script.Parent.SpotLight.Enabled = false
end end
but still no luck... |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 02 Feb 2014 10:57 AM |
| Does 'MinutesAfterMidnight' actually record minutes or seconds? |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 10:58 AM |
well seeing as it says minutes..
taste my fury!!!!!!!! |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 11:00 AM |
| Usually ROBLOX records in seconds, besides, it still won't work... |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 11:01 AM |
try tonumber() then
taste my fury!!!!!!!! |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 11:05 AM |
| I'm unfamiliar with tonumber(), how does it work? |
|
|
| Report Abuse |
|
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 02 Feb 2014 11:07 AM |
| It gives you minutes. Try reading your output dude, it should be game.Lighting:GetMinutesAfterMidnight() not game.Lighting.GetMinutesAfterMidnight() |
|
|
| Report Abuse |
|
|