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: RE: Working Lights

Previous Thread :: Next Thread 
LordDominayte is not online. LordDominayte
Joined: 20 Jul 2013
Total Posts: 449
26 Oct 2013 06:32 AM
Right, so my friend wants me to make a model for him. This is basically what it does;
There is one switch that controls all the lights in the model it is in (so you would have a model called LightSet1 with the Switch model and the Light model, which contains as many lights as needed). It kind of works but only one light turns on and off, presumably because they are all called the same thing and the script is getting confused. Is there any way to fix that other than naming all the lights different things, the reason being it would be a hassle to rename all the models AND the script would require editing to turn them all off? This is what I have so far:

s = script.Parent.Parent.Parent.LightModel.LightBrick.PointLight

function onClick()
s.Brightness = 0
end

script.Parent.ClickDetector.MouseClick:connect(onClick)

So the script is in the Switch model, which is inside the LightSet1 model.

.: LD :.
Report Abuse
LordDominayte is not online. LordDominayte
Joined: 20 Jul 2013
Total Posts: 449
26 Oct 2013 06:43 AM
Bump. Could someone help? :c

.: LD :.
Report Abuse
Quorum is not online. Quorum
Joined: 25 Oct 2013
Total Posts: 4680
26 Oct 2013 06:47 AM
s = script.Parent.Parent.Parent.LightModel

function onClick()
for _,v in pairs(s:GetChildren()) do
if v:FindFirstChild("PointLight") then
v.PointLight.Brightness = 0
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
Report Abuse
LordDominayte is not online. LordDominayte
Joined: 20 Jul 2013
Total Posts: 449
26 Oct 2013 06:59 AM
Nope, that doesn't work at all...

.: LD :.
Report Abuse
LordDominayte is not online. LordDominayte
Joined: 20 Jul 2013
Total Posts: 449
26 Oct 2013 07:02 AM
Keep in mind this is what the model is like:

LightSystem1 >
Lights >
Light
Light
Light

(the Light model contains:
Brick >
Light >
PointLight)

.: LD :.
Report Abuse
Quorum is not online. Quorum
Joined: 25 Oct 2013
Total Posts: 4680
26 Oct 2013 09:49 AM
Then change the 's' variable so it's directed to where all the lights are, which contain the PointLight.
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