|
| 17 Sep 2016 05:56 PM |
I was creating a time script that also changes the brightness of the world depending on the time of day according to EST. For some reason the script is a bit messed up(probably a mathematical error on my part). I already tried tweaking the algorithm I created but that still didn't work. The goal of the algorithm is to set brightness to 1 when it is noon and set it to 0 when it is midnight. Ideas?
while wait(0.1) do local t = (os.time() - 240) / 60 game.Lighting:SetMinutesAfterMidnight(t % 1440) game.Lighting.Brightness = math.sin(t / 8) game.Lighting.OutdoorAmbient = Color3.fromHSV(0, 0, game.Lighting.Brightness) end |
|
|
| Report Abuse |
|
|
Laedere
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
|
| 17 Sep 2016 05:57 PM |
| what's with this cancerous math |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2016 05:58 PM |
| Probably just my brain working on a lack of sleep. |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2016 06:00 PM |
| Oh wow I think I found a couple errors already. |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2016 06:02 PM |
Fixing that error fixed the script. Here's the fixed version to those who wanted it: while wait(0.1) do local t = ((os.time() - 240) / 60) % 1440 game.Lighting:SetMinutesAfterMidnight(t) game.Lighting.Brightness = math.sin(t / 8) game.Lighting.OutdoorAmbient = Color3.fromHSV(0, 0, game.Lighting.Brightness) end |
|
|
| Report Abuse |
|
|