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 » Scripting Helpers
Home Search
 

Re: How do I add time to TimeOfDay

Previous Thread :: Next Thread 
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
30 Jul 2011 03:36 PM
I don't want to set a time as string like "14:00:00".

I seen somebody do it before using a

for i = 1,[#seconds in a day].
--complicated stuff.
end
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
30 Jul 2011 03:46 PM
SetMinutesAfterMidnight(60)

would mean 01:00:00.
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
30 Jul 2011 03:49 PM
Is there anyway to set TimeOfDay value like a number? I tried:


Time = game:service("Lighting")

while true do
wait(.5)
Time:SetMinutesAfterMidnight(Time:GetMinutesAfterMidnight()+1)
if Time:GetMinutesAfterMidnight() >= "17:00" then
Time.ColorShift_Bottom = Time.ColorShift_Bottom +Color3.new(1,0,0)
if Time:GetMinutesAfterMidnight() >= "19:00" then
Time.ColorShift_Bottom = Color3.new(0,0,0)
end
end
end
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
30 Jul 2011 03:51 PM
If you want output:

Workspace.Day and Night Script:6: attempt to compare string with number




So is there anyway to get the value of Time:GetMinutesAfterMidnight()?
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
30 Jul 2011 03:59 PM
Derp. Barely anyone is helping.


Workspace.Day and Night Script:7: attempt to perform arithmetic on field 'ColorShift_Bottom' (a userdata value)




Time = game:service("Lighting")

while true do
wait(.5)
Time:SetMinutesAfterMidnight(Time:GetMinutesAfterMidnight()+1)
if Time:GetMinutesAfterMidnight() >= 960 then
Time.ColorShift_Bottom = Time.ColorShift_Bottom +Color3.new(1,0,0)
if Time:GetMinutesAfterMidnight() >= 1140 then
Time.ColorShift_Bottom.Color = Color3.new(0,0,0) --Line 7
end
end
end
Report Abuse
Nothingisimpossible is not online. Nothingisimpossible
Joined: 28 Jul 2011
Total Posts: 10
30 Jul 2011 03:59 PM
I am sure there was another function to set minutes after midnight. Forgot it... Give me a minute...
Report Abuse
Nothingisimpossible is not online. Nothingisimpossible
Joined: 28 Jul 2011
Total Posts: 10
30 Jul 2011 04:00 PM
Here. I think you wanted this one:

http://wiki.roblox.com/index.php/SetMinutesAfterMidnight_%28Method%29
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
30 Jul 2011 04:01 PM
Uhh, it's ok. I'm more worried about how to set the Color of ColorShift_Bottom
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
30 Jul 2011 04:06 PM
You can't add Color3 values. You have to do arithmetic on the numbers that make up the Color3s (r, g, and b).

local old = Time.ColorShift_Bottom
Time.ColorShift_Bottom = Color3.new(old.r + 1, old.g, old.b)

~Sorcus
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
30 Jul 2011 04:11 PM
It instantly sts the Red value to 255.
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
30 Jul 2011 04:13 PM
That's because Color3 works on a scale of 0 to 1, unlike what the properties window shows.

Color3.new(old.r + (1/255), old.g, old.b)

~Sorcus
Report Abuse
Ravenshield is not online. Ravenshield
Joined: 21 Nov 2007
Total Posts: 4143
30 Jul 2011 04:14 PM
By the way, to set TimeOfDay with values, you'd need the hh:mm:ss format.

Ex:

game.Lighting.TimeOfDay = "17:00:00"
Report Abuse
TheNewFissy is not online. TheNewFissy
Joined: 03 Jan 2011
Total Posts: 1301
30 Jul 2011 04:18 PM
You can set the TimeOfDay property like this:

game.Lighting.TimeOfDay = 4 -- 4:00:00
Report Abuse
Ravenshield is not online. Ravenshield
Joined: 21 Nov 2007
Total Posts: 4143
30 Jul 2011 04:19 PM
Really? That's interesting.

hh:mm doesn't work, though(?). It at least didn't back when I worked with TimeOfDay back in 08, as I can remember.
Report Abuse
TheNewFissy is not online. TheNewFissy
Joined: 03 Jan 2011
Total Posts: 1301
30 Jul 2011 04:22 PM
It does.
Report Abuse
Ravenshield is not online. Ravenshield
Joined: 21 Nov 2007
Total Posts: 4143
30 Jul 2011 04:23 PM
Hnm, okay. I guess I should refresh my knowledge a bit.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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