generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Setting brightness messed up

Previous Thread :: Next Thread 
CodeBreadpudding is not online. CodeBreadpudding
Joined: 24 Aug 2016
Total Posts: 1286
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 is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
17 Sep 2016 05:57 PM
what's with this cancerous math
Report Abuse
CodeBreadpudding is not online. CodeBreadpudding
Joined: 24 Aug 2016
Total Posts: 1286
17 Sep 2016 05:58 PM
Probably just my brain working on a lack of sleep.
Report Abuse
CodeBreadpudding is not online. CodeBreadpudding
Joined: 24 Aug 2016
Total Posts: 1286
17 Sep 2016 06:00 PM
Oh wow I think I found a couple errors already.
Report Abuse
CodeBreadpudding is not online. CodeBreadpudding
Joined: 24 Aug 2016
Total Posts: 1286
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image