|
| 17 Feb 2015 07:40 PM |
I'm trying to write a script that changes the OutdoorAmbient to be darker as time passes (I already have a day cycle script). However, I have no idea how would tell the script how to check the TimeOfDay. Please note that I'm fairly new to scripting, and trying to learn. Here it is:
local Lighting= game.Lighting
while true do if Lighting.TimeOfDay< "6:00:00" then Lighting.OutdoorAmbient= Color3.new(132,132,132) end if Lighting.TimeOfDay< "17:50:00" then Lighting.OutdoorAmbient= Color3.new(100,100,100) end if Lighting.TimeOfDay< "20:00:00" then Lighting.OutdoorAmbient= Color3.new(71,71,71) end if Lighting.TimeOfDay< "20:50:00" then Lighting.OutdoorAmbient= Color3.new(35,35,35) end end |
|
|
| Report Abuse |
|
|
K7Q
|
  |
| Joined: 23 Mar 2013 |
| Total Posts: 5546 |
|
|
| 17 Feb 2015 07:42 PM |
| Lighting.OutdoorAmbient = Color3.new(#/225, #/225, #/225) |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Feb 2015 08:07 PM |
local lighting = game.Lighting
lighting.Changed:connect(function(property) if property == 'TimeOfDay' then local minutesAfter = lighting:GetMinutesAfterMidnight() local ambientValue = math.floor(-0.0002450 * minutesAfter ^ 2 + 0.3528 * minutesAfter) lighting.OutdoorAmbient = Color3.new(ambientValue/255, ambientValue/255, ambientValue/255) end end)
|
|
|
| Report Abuse |
|
|
|
| 17 Feb 2015 08:33 PM |
@The replies, I recommend you guys explain the script, instead of just simply posting code.
"I like to program." - Bosswalrus |
|
|
| Report Abuse |
|
|