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: Help with script broken script [Output included]

Previous Thread :: Next Thread 
RoboX790 is not online. RoboX790
Joined: 05 Nov 2009
Total Posts: 285
29 Aug 2013 11:00 AM
It's a light on/off script but it's automated here is the script you can understand it clearly:

while true do
if game.Lighting.TimeOfDay = 08:00:00 then --Lights off at this time.
script.Parent.1.SpotLight.Enabled = false
script.Parent.2.SpotLight.Enabled = false
script.Parent.3.SpotLight.Enabled = false
script.Parent.4.SpotLight.Enabled = false
if game.Lighting.TimeOfDay = 17:30:00 then --Lights on at this time
script.Parent.1.SpotLight.Enabled = true
script.Parent.2.SpotLight.Enabled = true
script.Parent.3.SpotLight.Enabled = true
script.Parent.4.SpotLight.Enabled = true
end --Ending the three lines
end
end

Output:
20:55:01.355 - Workspace.Light.Script:2: 'then' expected near '='


Any Help? :(
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
29 Aug 2013 11:11 AM
= 08:00:00 then

you are setting the time to that.....also don't do it like that T_T
== is comparator
do this :P

game.Lighting:GetMinutesAfterMidnight() > 480 then --8:00 :P
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
29 Aug 2013 11:19 AM
Or just do:

if game.Lighting.TimeOfDay = "18:00:00" then
end
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
29 Aug 2013 11:21 AM
Umm you forget.....

= is setting the left side value to the right side
== is comparing the left side value to the right side
since if this script is VERY good at firing when it is exactly 18:00:00...== could work...but just use mine for simplicity :P
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
29 Aug 2013 11:25 AM
Oops, yeah, typo. Should be double equal signs. Also, you need a wait of some sort. The script you have here will crash the game.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Aug 2013 11:27 AM
Also, you're missing an end, and the second if will never fire because it's listed under the first condition in which it can't be both at the same time. To fix both problems, add an end before the second if, or change the second if to an elseif.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Aug 2013 11:27 AM
Regard the missing end. You should either move one of the ends before the second if statement, or change it to an elseif.
Report Abuse
RoboX790 is not online. RoboX790
Joined: 05 Nov 2009
Total Posts: 285
29 Aug 2013 12:11 PM
Okay thanks for the help :)
Report Abuse
xxBsFxx is not online. xxBsFxx
Joined: 26 Aug 2013
Total Posts: 3281
29 Aug 2013 12:33 PM
[ Content Deleted ]
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
29 Aug 2013 12:34 PM
You only need one wait if you don't have like a thousand other scripts with while loops
Report Abuse
Ludici is not online. Ludici
Joined: 22 Jul 2013
Total Posts: 640
29 Aug 2013 12:38 PM
What they are saying is true. But if you have a day/night script, I'm pretty sure that you should change the ='s to >=

~Make the simple, amazing~
Report Abuse
xxBsFxx is not online. xxBsFxx
Joined: 26 Aug 2013
Total Posts: 3281
29 Aug 2013 12:41 PM
[ Content Deleted ]
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
29 Aug 2013 12:41 PM
I just do wait(0.000000001)
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
29 Aug 2013 12:42 PM
But for this script wouldn't it be better to waitforchange?
Report Abuse
xxBsFxx is not online. xxBsFxx
Joined: 26 Aug 2013
Total Posts: 3281
29 Aug 2013 12:43 PM
[ Content Deleted ]
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
29 Aug 2013 12:45 PM
I just got up this morning and haven't finished my coffee okay
And .Changed would still be better than a while loop
Report Abuse
xxBsFxx is not online. xxBsFxx
Joined: 26 Aug 2013
Total Posts: 3281
29 Aug 2013 12:47 PM
[ Content Deleted ]
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
29 Aug 2013 12:53 PM
function light()
if game.Lighting.TimeOfDay=="18:00:00" then print("yes")
else print("nope") end
end
game.Lighting.Changed:connect(light)

That way it doesn't have to be constantly looping
Report Abuse
xxBsFxx is not online. xxBsFxx
Joined: 26 Aug 2013
Total Posts: 3281
29 Aug 2013 12:56 PM
[ Content Deleted ]
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
29 Aug 2013 12:58 PM
It doesn't have to be TimeOfDay.Value because it can just check every time the time changes since TOD is in Lighting.
And that's why I have the "if" there.
Report Abuse
xxBsFxx is not online. xxBsFxx
Joined: 26 Aug 2013
Total Posts: 3281
29 Aug 2013 01:02 PM
[ Content Deleted ]
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
29 Aug 2013 01:04 PM
It doesn't matter because
MY SCRIPT WORKS
Report Abuse
xxBsFxx is not online. xxBsFxx
Joined: 26 Aug 2013
Total Posts: 3281
29 Aug 2013 01:08 PM
[ Content Deleted ]
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
29 Aug 2013 01:31 PM
What do you want me to do, make a video and upload it to youtube just to prove it? It works find for me, you must be copying something wrong.
Report Abuse
xxBsFxx is not online. xxBsFxx
Joined: 26 Aug 2013
Total Posts: 3281
29 Aug 2013 01:32 PM
[ Content Deleted ]
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