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: Simple Timed Light

Previous Thread :: Next Thread 
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
01 Feb 2014 03:27 PM
I'm making a light that works in accordance to what time it is in-game, I.E. the light will turn on at night. I'm a n00b scripter and it's been a long time since I've been on ROBLOX so any help is greatly appreciated, thanks.


if game.Lighting.TimeOfDay > "20:00:00"
or game.Lighting.TimeofDay < "8:00:00"
then script.Parent.SpotLight.Brightness = 10
end
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
01 Feb 2014 03:29 PM
while wait() do
if game.Lighting.TimeOfDay > "20:00:00" or game.Lighting.TimeofDay < "8:00:00" then
script.Parent.SpotLight.Brightness = 10
else
script.Parent.SpotLight.Brightness = 0
end
end
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
01 Feb 2014 03:32 PM
Thank you very much!
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
01 Feb 2014 03:34 PM
Actually, after testing, that still doesn't work :T
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
01 Feb 2014 03:42 PM
Actually, look at the if statement

the first time it says TimeOfDay
the second time it is TimeofDay
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
01 Feb 2014 03:45 PM
Oof! I'm always doing things like that! o:
Thanks, man.
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
01 Feb 2014 03:52 PM
Hmm, it turns on now, but it never turns back off, oddly...
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
01 Feb 2014 04:21 PM
You never turned it off anywhere in the script, so why would it turn off?

use "else"

else
light.Enabled = false
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
01 Feb 2014 04:24 PM
I mean Diamond's script.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
01 Feb 2014 04:32 PM
Oh, didn't see that. Try just disabling it.
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
01 Feb 2014 06:47 PM
No, that still doesn't work.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
01 Feb 2014 06:54 PM
You can't compare strings with the numerical comparison operators (<, <=, >, >=) in Lua. You're gonna have to use the Lighting::GetMinutesAfterMidnight method and compare THOSE values.
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
01 Feb 2014 08:07 PM
I tried,

while wait() do
if game.Lighting:GetMinutesAfterMidnight() > 1200 or game.Lighting.GetMinutesAfterMidnight() < 480 then
script.Parent.SpotLight.Enabled = true
else
script.Parent.SpotLight.Enabled = false

end
end



but still no luck...
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
01 Feb 2014 08:54 PM
Bump
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
02 Feb 2014 08:44 AM
Bump
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
02 Feb 2014 09:24 AM
Bump
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
02 Feb 2014 10:57 AM
Does 'MinutesAfterMidnight' actually record minutes or seconds?
Report Abuse
rossb654mail is not online. rossb654mail
Joined: 12 Oct 2009
Total Posts: 11004
02 Feb 2014 10:58 AM
well seeing as it says minutes..

taste my fury!!!!!!!!
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
02 Feb 2014 11:00 AM
Usually ROBLOX records in seconds, besides, it still won't work...
Report Abuse
rossb654mail is not online. rossb654mail
Joined: 12 Oct 2009
Total Posts: 11004
02 Feb 2014 11:01 AM
try tonumber() then

taste my fury!!!!!!!!
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
02 Feb 2014 11:05 AM
I'm unfamiliar with tonumber(), how does it work?
Report Abuse
Kingmouli is not online. Kingmouli
Joined: 28 Sep 2012
Total Posts: 1292
02 Feb 2014 11:07 AM
It gives you minutes. Try reading your output dude, it should be game.Lighting:GetMinutesAfterMidnight() not game.Lighting.GetMinutesAfterMidnight()
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