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: Street Lamp Script

Previous Thread :: Next Thread 
JekutoNightra is not online. JekutoNightra
Joined: 02 Mar 2011
Total Posts: 112
13 Aug 2011 08:38 PM
Hey guys.

So, I have this street lamp, and I have a script that changes the time of day, but I want the bulb of the Street Lamp to turn on at a certain time.

At 8:00PM (20:00:00) the light turns on, and at 8:00AM (8:00:00) the light turn's off. The bulb is called "bulb", the light is called "light" (both without quote's), the color of the bulb when on is "New Yeller" and when lamp is off, bulb's color should be "Mid Grey". The bulb should be off at ANY time BETWEEN 8:00AM (8:00:00) to 8:00PM (20:00:00) and on from 20:00:00 to 8:00:00. Also, when on, light should have transparency 0.5, and off with a transparancy of 1.

Thanks in advance for all your help.

Cheers,
JekutoNightra
Report Abuse
Greendolph is not online. Greendolph
Joined: 07 May 2008
Total Posts: 2543
13 Aug 2011 08:39 PM
Do you have a script?
Report Abuse
JekutoNightra is not online. JekutoNightra
Joined: 02 Mar 2011
Total Posts: 112
13 Aug 2011 08:40 PM
Yes, I'll post it in a sec.
Report Abuse
JoshJosh117 is not online. JoshJosh117
Joined: 22 Jul 2007
Total Posts: 4862
13 Aug 2011 08:40 PM
no, he is asking for one
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
13 Aug 2011 08:42 PM
its been a sec...
Report Abuse
JekutoNightra is not online. JekutoNightra
Joined: 02 Mar 2011
Total Posts: 112
13 Aug 2011 08:44 PM
Here's the script:

bulb=script.Parent.bulb
light=script.Parent.light

while true do
if game.Lighting.TimeOfDay>="20:00:00" and game.Lighting.TimeOfDay>"24:00:00" then
light.Transparency=0.5
bulb.BrickColor=BrickColor.new("New Yeller")
elseif game.Lighting.TimeOfDay>="24:00:00" and game.Lighting.TimeOfDay<"08:00:00" then
light.Transparency=0.5
bulb.BrickColor=BrickColor.new("New Yeller")
else
light.Transparency=1
bulb.BrickColor=BrickColor.new("Mid Grey")
end
wait()
end


This is in a group with the light and the bulb. I've moved the time to 20:00:01 and copied the light, but it isnt turning on.
Report Abuse
JoshJosh117 is not online. JoshJosh117
Joined: 22 Jul 2007
Total Posts: 4862
13 Aug 2011 08:52 PM
how about something more like

bulb=script.Parent.bulb
light=script.Parent.light

game.Lighting.TimeOfDay.Changed:connect(function(time)
if time == "20:00:00" then
light.Transparency=0.5
bulb.BrickColor=BrickColor.new("New Yeller")
end
if time == "8:00:00" then
light.Transparency=1
bulb.BrickColor=BrickColor.new("Mid Grey")
end
end


this is assuming your day/night script will hit exactly those times
Report Abuse
JekutoNightra is not online. JekutoNightra
Joined: 02 Mar 2011
Total Posts: 112
13 Aug 2011 08:54 PM
Its an interesting script, in which the time of day is live with PST. Its really neat, but uhm, If I start the game and the game tiem is 21:00:00, then it wont work. The other script is pretty acurate, because it turns on if it is in between those times.
Report Abuse
JoshJosh117 is not online. JoshJosh117
Joined: 22 Jul 2007
Total Posts: 4862
13 Aug 2011 08:57 PM
forgot the ) at the end, sorry

and just make your game start before 20:00:00
Report Abuse
malachi11 is not online. malachi11
Joined: 07 May 2008
Total Posts: 2420
13 Aug 2011 09:11 PM
bulb=script.Parent.bulb
light=script.Parent.light

game.Lighting.Changed:connect(function(time)
if time == "TimeOfDay" then
light.Transparency=0.5
bulb.BrickColor=BrickColor.new("New Yeller")
end
if time == "TimeOfDay" then
light.Transparency=1
bulb.BrickColor=BrickColor.new("Mid Grey")
end
end
end)
Report Abuse
JoshJosh117 is not online. JoshJosh117
Joined: 22 Jul 2007
Total Posts: 4862
13 Aug 2011 09:13 PM
@malachi
that isn't going to work
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