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: How would I check the TimeOfDay in a script?

Previous Thread :: Next Thread 
XxDarkMiragexX is not online. XxDarkMiragexX
Joined: 26 Mar 2013
Total Posts: 160
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 is not online. K7Q
Joined: 23 Mar 2013
Total Posts: 5546
17 Feb 2015 07:42 PM
Lighting.OutdoorAmbient = Color3.new(#/225, #/225, #/225)
Report Abuse
XxDarkMiragexX is not online. XxDarkMiragexX
Joined: 26 Mar 2013
Total Posts: 160
17 Feb 2015 07:49 PM
So what does that do?
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
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
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
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
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