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: TimeOfDay Script Not Working

Previous Thread :: Next Thread 
luigi01302 is not online. luigi01302
Joined: 12 Jul 2009
Total Posts: 511
23 Sep 2012 08:01 PM
Workspace.TimeOfDay:2: ',' expected near ':'

This is the error that appears whenever I try to modify the existing script.

Here's the actual script.

while true do
for i = 00:00:00, 23:40:00, +00:00:04, do
F = game:service("Lighting")
F:SetMinutesAfterMidnight(F:GetMinutesAfterMidnight(i))
wait(2.5)
print(i)
end
end

What would be wrong here? This script looks mostly correct to me. Can the "for" loop be put in here with the Set and GetMinutesAfterMidnight?

Report Abuse
CrazyBananaMonkey is not online. CrazyBananaMonkey
Joined: 10 Nov 2009
Total Posts: 1599
23 Sep 2012 08:08 PM
'For' loops can only have numbers;

    for i = 1, 4 do

is correct, but

    for i = 00:01, 24:00 do

is incorrect.

http://wiki.roblox.com/index.php/In-Depth_Scripting_Guide#The_.27for.27_Statement
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
23 Sep 2012 08:12 PM
@crazybanana

As of a fact you are correct, that's not his problem. His problem is the TimeOfDay value takes a string value. So when you use a for loop you're trying to compare a number value from a string value.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
23 Sep 2012 08:14 PM
You can always

String = "12:42:23"
Hr = string.sub(String, 1, 2)
Min = string.sub(String, 3, 4)
Sec = string.sub(String, 5, 6)

i think

he can always do

while true and wait() do
..GetMinutesAfterMidnight + 1?
end
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
23 Sep 2012 08:16 PM
> 'For' loops can only have numbers;

Not true.

¤ ¤ † K M X D † ¤ ¤
Report Abuse
luigi01302 is not online. luigi01302
Joined: 12 Jul 2009
Total Posts: 511
23 Sep 2012 08:16 PM
So, how would you write the script?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
23 Sep 2012 08:17 PM

while true and wait() do
..GetMinutesAfterMidnight + 1?
end



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