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 » Scripters
Home Search
 

Re: Neon Lighting question

Previous Thread :: Next Thread 
177117 is not online. 177117
Joined: 17 May 2010
Total Posts: 1366
10 Feb 2016 03:48 PM
lightPart = game.Workspace.LightPart
minutesAfterMidnight = 0
while true do
minutesAfterMidnight = minutesAfterMidnight + 10
game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight)
wait(.1)

if game.Lighting.TimeOfDay == "06:00:00" then
lightPart.Material = Enum.Material.Plastic
lightPart.PointLight.Enabled = false
end
if game.Lighting.TimeOfDay == "18:00:00" then
lightPart.Material = Enum.Material.Neon
lightPart.PointLight.Enabled = true
end
end

The script above makes all parts named "LightPart" turn neon at night. Although, when I put it into workspace, it only makes 1 part named "LightPart" become neon at the night. The others do not.

Does anybody know what could be causing this?
Report Abuse
Superwarrior360 is not online. Superwarrior360
Joined: 21 Feb 2013
Total Posts: 2703
10 Feb 2016 03:55 PM
I could be wrong, but it's probably because the variable lightPart only refers to one brick in workspace name LightPart.
Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
10 Feb 2016 03:57 PM
No, hon, this just does the single one. You'll need a loop:

minutesAfterMidnight = 0
while true do
minutesAfterMidnight = minutesAfterMidnight + 10
game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight)
wait(.1)
local setting = (game.Lighting.TimeOfDay=='06:00:00' and 'm') or (game.Lighting.TimeOfDay=='18:00:00' and 'n')
if setting then
for _,v in next,workspace:GetChildren() do
if v.Name=='LightPart' then
v.Material = setting=='n' and 'Neon' or 'Plastic'
v.PointLight.Enabled = setting=='n' and true or false
end
end
end
Report Abuse
177117 is not online. 177117
Joined: 17 May 2010
Total Posts: 1366
10 Feb 2016 03:58 PM
Alright. Thanks, I'll see what I can do.
Report Abuse
177117 is not online. 177117
Joined: 17 May 2010
Total Posts: 1366
12 Feb 2016 08:59 AM
@phoenix

I can't get your script to work. Not sure why.
Report Abuse
177117 is not online. 177117
Joined: 17 May 2010
Total Posts: 1366
12 Feb 2016 09:10 AM
Hmm can anyone edit the original script to make it affect multiple parts with the name "LightPart?"
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
12 Feb 2016 09:35 AM
you could try using GetChildren()

http://wiki.roblox.com/index.php?title=API:Class/Instance/GetChildren
Report Abuse
177117 is not online. 177117
Joined: 17 May 2010
Total Posts: 1366
12 Feb 2016 09:44 AM
Hmm, alright. This will help.
Report Abuse
177117 is not online. 177117
Joined: 17 May 2010
Total Posts: 1366
12 Feb 2016 09:55 AM
Ok so I tried getchildren, and all it did was switch the window that changes color/material, its still only one.
Report Abuse
177117 is not online. 177117
Joined: 17 May 2010
Total Posts: 1366
12 Feb 2016 10:17 AM
bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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