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: There has to be a more efficient way to do this ..

Previous Thread :: Next Thread 
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
09 Jun 2015 09:40 PM
while true do
game.Lighting.TimeOfDay = ("14:00:00")
wait(10)
game.Lighting.TimeOfDay = ("15:00:00")
wait(10)
game.Lighting.TimeOfDay = ("16:00:00")
wait(10)
game.Lighting.TimeOfDay = ("17:00:00")
wait(10)
game.Lighting.TimeOfDay = ("18:00:00")
wait(10)
game.Lighting.TimeOfDay = ("19:00:00")
wait(10)
game.Lighting.TimeOfDay = ("20:00:00")
wait(10)
game.Lighting.TimeOfDay = ("21:00:00")
wait(10)
game.Lighting.TimeOfDay = ("22:00:00")
wait(10)
game.Lighting.TimeOfDay = ("23:00:00")
wait(10)
game.Lighting.TimeOfDay = ("00:00:00")
wait(10)
game.Lighting.TimeOfDay = ("01:00:00")
wait(10)
game.Lighting.TimeOfDay = ("02:00:00")
wait(10)
game.Lighting.TimeOfDay = ("03:00:00")
wait(10)
game.Lighting.TimeOfDay = ("04:00:00")
wait(10)
game.Lighting.TimeOfDay = ("05:00:00")
wait(10)
game.Lighting.TimeOfDay = ("06:00:00")
wait(10)
game.Lighting.TimeOfDay = ("07:00:00")
wait(10)
game.Lighting.TimeOfDay = ("08:00:00")
wait(10)
game.Lighting.TimeOfDay = ("09:00:00")
wait(10)
game.Lighting.TimeOfDay = ("10:00:00")
wait(10)
game.Lighting.TimeOfDay = ("11:00:00")
wait(10)
game.Lighting.TimeOfDay = ("12:00:00")
wait(10)
game.Lighting.TimeOfDay = ("13:00:00")
wait(10)
end
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
09 Jun 2015 09:41 PM
http://wiki.roblox.com/index.php?title=SetMinutesAfterMidnight
Also for loops.
Report Abuse
morash is not online. morash
Joined: 22 May 2010
Total Posts: 5834
09 Jun 2015 09:56 PM
hour = 0

while true do
hour = hour + 1
game.Lighting:SetMinutesAfterMidnight(hour * 60)
wait(1)
end
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
09 Jun 2015 10:04 PM
local t = 0
local tab = {}
local met = {
__add = function(self,a)
game.Lighting:SetMinutesAfterMidnight(a)
end
}

setmetatable(tab.met)

while wait(10) do
t = t + 1
end
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
09 Jun 2015 10:15 PM
Rennovation

local tab = {}
setmetatable(tab,{
__add = function()
game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight()+60)
end
})

while wait(1) do
add = tab + 1
end
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
09 Jun 2015 10:17 PM
Goul, you're making things way more complicated than what they need to be.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
09 Jun 2015 10:18 PM
yeah but metatables :c
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
09 Jun 2015 10:20 PM
Metatables are meant for facilitating table manipulation, not changing remote variables. Doing things more complexly creates room for error, as can be seen in both your original and your revision.
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
09 Jun 2015 10:22 PM
Morash's script did not work
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
09 Jun 2015 10:24 PM
Lol mine does
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
09 Jun 2015 10:26 PM
I want a script I can understand
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
09 Jun 2015 10:31 PM
Here you go. This is tested and works.

local Hour = 0
local Lighting = game.Lighting

while wait(1) do
Lighting:SetMinutesAfterMidnight(Hour * 60)
Hour = Hour + 1
if (Hour > 24) then
Hour = 0
end
end

All you are doing is setting the minutes after midnight. Since it's in minutes, we convert the Hour variable to minutes by multiplying it by 60 (obvious conversion). When the hours is bigger than 24, set it back to 0. Because 25 hours in a day doesn't make sense.
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
09 Jun 2015 10:31 PM
Finally someone that doesn't try to show off and keeps it simple for me

thank you
Report Abuse
hyyt8 is not online. hyyt8
Joined: 02 May 2007
Total Posts: 1760
09 Jun 2015 10:39 PM
Mine is best.

i=1
while wait(.16) do
game.Lighting.TimeOfDay = "00:0"..tostring(i)..":00"
i=i+1
end
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
09 Jun 2015 10:41 PM
@kingkiller wtf do you even know about scripting. why dont you just hop off
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
09 Jun 2015 10:50 PM
timeofday is weird

why is there no 24:00:00 but instead there is 0:00:00
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
09 Jun 2015 10:52 PM
> why is there no 24:00:00 but instead there is 0:00:00

Because that's how a 24-hour clock works.
Report Abuse
hyyt8 is not online. hyyt8
Joined: 02 May 2007
Total Posts: 1760
09 Jun 2015 10:56 PM
So, yes, we all agree that my script is best? :)
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
09 Jun 2015 11:04 PM
So 23:59 is actually the end of the day, and not 24:00?

and 00:00 is exact midnight?
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
09 Jun 2015 11:06 PM
Yes, 00:00:00 is midnight. The last second of the day is 23:59:59.
Report Abuse
hyyt8 is not online. hyyt8
Joined: 02 May 2007
Total Posts: 1760
09 Jun 2015 11:07 PM
yea
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
10 Jun 2015 05:01 AM
I still think mine is the best
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