A Roblox Community

A community of Robloxians who want to learn to script and build on Roblox Studio.
 
HomeFAQRegisterLog in
If you're a experienced coder make some tutorials! It would really help the site grow.
Make sure you read the rules(Which can be found by clicking here)
If you're a beginner at coding, try some tutorials.
We have many Moderators/Admins watching this site. Contact them with Questions.
Let us know what your favorite sport is. By clicking here to vote (Click here)
This site is becoming inactive. Lets make it active.
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Top posters
blueymaddog
 
naknak
 
Supernapalm
 
m27frogy
 
slayer9365
 
myrco919
 
branefreez
 
ninga95
 
CloneTrooper787
 
raboy117
 
Top posting users this month
Latest topics
» Send me an Email
January 8th 2016, 10:14 am by naknak

» [v1.6.0.0] Lua Script Obfuscator [No Bytecode]
July 6th 2015, 7:38 pm by m27frogy

» New Site Possibly
July 6th 2015, 4:16 pm by m27frogy

» Ambassador!
April 15th 2015, 11:40 pm by naknak

» Boop - Tag
April 13th 2015, 9:46 pm by naknak

» Vip Class Script
April 13th 2015, 4:54 pm by naknak

» Who's active?!
April 13th 2015, 4:52 pm by naknak

» Where to go from here.
April 13th 2015, 4:51 pm by naknak

» Genesis Point
July 17th 2014, 7:04 pm by branefreez

» Reward System
July 17th 2014, 5:41 am by m27frogy

» Script Request
July 10th 2014, 11:43 am by naknak

» local scripts?
July 10th 2014, 11:39 am by naknak

» Project: Reconstruction [Died]
July 10th 2014, 11:36 am by naknak

» Hi. I am new here
April 26th 2014, 4:01 pm by altshiftkey

» What's your favorite sport?
January 1st 2014, 2:13 pm by m27frogy

» FlashLight Script
January 1st 2014, 2:11 pm by m27frogy

» Gun Making! [READ DESC]
January 1st 2014, 2:10 pm by m27frogy

» Hi, I am new here!
November 26th 2013, 3:33 pm by Keanu73

» Improve Coding
October 26th 2013, 1:12 pm by pook03

» Simple Button
September 1st 2013, 6:19 pm by branefreez


Share | 
 

 Time changing script - Loops forever

Go down 
AuthorMessage
Prodigy
Administrator
Administrator


Posts : 58
Join date : 2010-07-28

PostSubject: Time changing script - Loops forever   August 3rd 2010, 12:33 pm

Code:
speed = 2 --Sets the speed of the time changing.
sec = 0
min = 0
hour = 0
while true do
   game.Lighting.TimeOfDay = ""..hour..":"..min..":"..sec.."" --The time of day is equal to the amount of hours, minutes, and seconds.
   sec = sec + (5*speed) --Add 5*Speed to the seconds value. Meaning, add 10 seconds to the time.

   if sec >= 60 then --If the seconds value is equal to or more than 60
      sec = 0 --make seconds equal to zero and
      min = min + 1 --Add a minute to the minute value
   end

   if min >= 60 then --If the minutes value is equal to or more than 60
      min = 0 --make the amount of minutes equal to zero and
      hour = hour + 1 --add one hour to the hour value
   end

   if hour >= 24 then --if the hours value is equal to or more than 24
      hour = 0 --make the ammount of hours equal to zero and restart the script
   end

   wait(0.05) --Run the script every 5 mili-seconds
end
Back to top Go down
http://roblox.forumclan.com
naknak
Administrator
Administrator
avatar

Posts : 878
Join date : 2010-07-30

PostSubject: Re: Time changing script - Loops forever   August 3rd 2010, 10:21 pm

You could make it slightly more effeicent....
Code:
speed = 2 --Sets the speed of the time changing.
local sec = 0
local min = 0
local hour = 0
while wait(.05) do
  game.Lighting.TimeOfDay = ""..hour..":"..min..":"..sec.."" --The time of day is equal to the amount of hours, minutes, and seconds.
  sec = sec + (5*speed) --Add 5*Speed to the seconds value. Meaning, add 10 seconds to the time.

  if sec >= 60 then --If the seconds value is equal to or more than 60
      sec = 0 --make seconds equal to zero and
      min = min + 1 --Add a minute to the minute value
  end

  if min >= 60 then --If the minutes value is equal to or more than 60
      min = 0 --make the amount of minutes equal to zero and
      hour = hour + 1 --add one hour to the hour value
  end

  if hour >= 24 then --if the hours value is equal to or more than 24
      hour = 0 --make the ammount of hours equal to zero and restart the script
  end
end
Back to top Go down
Prodigy
Administrator
Administrator


Posts : 58
Join date : 2010-07-28

PostSubject: Re: Time changing script - Loops forever   August 7th 2010, 3:32 pm

It's the same exact thing... It doesn't make it more efficient or less efficient.
Back to top Go down
http://roblox.forumclan.com
naknak
Administrator
Administrator
avatar

Posts : 878
Join date : 2010-07-30

PostSubject: Re: Time changing script - Loops forever   August 8th 2010, 1:02 am

you would save more time and effort my way...
Back to top Go down
Prodigy
Administrator
Administrator


Posts : 58
Join date : 2010-07-28

PostSubject: Re: Time changing script - Loops forever   August 8th 2010, 10:26 am

naknak wrote:
you would save more time and effort my way...
Okay... but typing four extra letters isn't time consuming and doesn't take any effort.
Back to top Go down
http://roblox.forumclan.com
Guest
Guest



PostSubject: Re: Time changing script - Loops forever   August 8th 2010, 8:12 pm

You can not only shorten it, but make it MUCH neater and efficent.

Code:
 --I remembered the block xD
Speed = 2
while true do
game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight() + Speed / 60)
wait(0.05)
end
Back to top Go down
naknak
Administrator
Administrator
avatar

Posts : 878
Join date : 2010-07-30

PostSubject: Re: Time changing script - Loops forever   August 9th 2010, 10:14 pm

I think voidhack wins...
Back to top Go down
Guest
Guest



PostSubject: Re: Time changing script - Loops forever   August 10th 2010, 3:15 pm

I think I win also. I remembered the code for adding code xD
Back to top Go down
Supernapalm
Expert Scripter
Expert Scripter


Posts : 393
Join date : 2011-01-17

PostSubject: Re: Time changing script - Loops forever   January 18th 2011, 10:10 pm

is this just a time changing thing for the lighting? if it is, who would want to use it?
Back to top Go down
http://hackthissite.org
naknak
Administrator
Administrator
avatar

Posts : 878
Join date : 2010-07-30

PostSubject: Re: Time changing script - Loops forever   January 18th 2011, 10:15 pm

To make your map have day and night.
Back to top Go down
Supernapalm
Expert Scripter
Expert Scripter


Posts : 393
Join date : 2011-01-17

PostSubject: Re: Time changing script - Loops forever   January 18th 2011, 10:21 pm

the point is that i do not want a day and night script
Back to top Go down
http://hackthissite.org
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 19

PostSubject: Re: Time changing script - Loops forever   January 20th 2011, 6:53 pm

the point is that others might want it.

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
naknak
Administrator
Administrator
avatar

Posts : 878
Join date : 2010-07-30

PostSubject: Re: Time changing script - Loops forever   January 20th 2011, 7:10 pm

Exactly
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 19

PostSubject: Re: Time changing script - Loops forever   January 24th 2011, 9:04 am

lol I win.

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
slayer9365
Expert Scripter
Expert Scripter
avatar

Posts : 233
Join date : 2010-07-31
Age : 23

PostSubject: Re: Time changing script - Loops forever   January 24th 2011, 9:08 pm

Actually voidhack still wins.
Back to top Go down
naknak
Administrator
Administrator
avatar

Posts : 878
Join date : 2010-07-30

PostSubject: Re: Time changing script - Loops forever   January 24th 2011, 10:08 pm

Code:
S = 2
while wait(.05) do
game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight()+S/60)
end


hmm...
Back to top Go down
Supernapalm
Expert Scripter
Expert Scripter


Posts : 393
Join date : 2011-01-17

PostSubject: Re: Time changing script - Loops forever   January 24th 2011, 10:37 pm

Code:
while wait(0.05) do
game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight()+%Speed%/60)
end
you don't need a variable, that saves time and, for this exception, space
Back to top Go down
http://hackthissite.org
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 19

PostSubject: Re: Time changing script - Loops forever   January 26th 2011, 10:40 am

lol, why would make a fuss over the smallest things? =P

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
Sponsored content




PostSubject: Re: Time changing script - Loops forever   

Back to top Go down
 
Time changing script - Loops forever
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
A Roblox Community :: Tutorials and Resources :: Free Scripts-
Jump to: