|
| 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 |
|
|
| |
|
|
| 13 Aug 2011 08:40 PM |
| Yes, I'll post it in a sec. |
|
|
| Report Abuse |
|
|
| |
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 13 Aug 2011 09:13 PM |
@malachi that isn't going to work |
|
|
| Report Abuse |
|
|