|
| 29 Apr 2017 08:25 AM |
| Ok, so I used the script from the wiki to make a streetlight but instead i told it to change the transparency to 1 after 6 am and then change it back to 0 when it's night and change it's material option to neon. ok that's not the problem, the problem is that after I made the script I've put it into the part name LightPart, then I proceeded to copy that part onto random windows of my building. now I have thousands of parts named LightPart into my workshop but only one ###### up at night help wat do |
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Apr 2017 09:50 AM |
lightPart = game.Workspace.LightPart minutesAfterMidnight = 5 * 60
while true do minutesAfterMidnight = minutesAfterMidnight + 1 game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight) wait(.1) if game.Lighting:GetMinutesAfterMidnight() == 6 * 60 then lightPart.Material = Enum.Material.Plastic lightPart.Transparency = 1 end
if game.Lighting:GetMinutesAfterMidnight() == 18 * 60 then lightPart.Material = Enum.Material.Neon lightPart.Transparency = 0 end end |
|
|
| Report Abuse |
|
|
Dankvisky
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 5430 |
|
|
| 29 Apr 2017 09:52 AM |
You are affecting only 1 part. Did you name them the same hoping that it will affect them all?
|
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Apr 2017 09:57 AM |
| When an instance and another one has the same name, roblox will choose one of them randomly and run code on the one picked |
|
|
| Report Abuse |
|
|
|
| 29 Apr 2017 09:59 AM |
| is there any way to make a script that will affect it's parent? i mean sorry if it's a dumb question but im kind of a novice |
|
|
| Report Abuse |
|
|
Dankvisky
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 5430 |
|
|
| 29 Apr 2017 10:04 AM |
You could group them and then do this on the model:
for i, v in pairs(workspace.MODELNAME:GetChildren()) do -- i is the counter for which part it picks, -- v is the picked part (it picks them all in order!
v.BrickColor = BrickColor.new("Lime green") --sample code on how to use it end
It will run trough all the parts in model, part's (current) variable will be v and you can do your stuff from there. See more: http://wiki.roblox.com/index.php?title=Global_namespace/Basic_functions#pairs http://wiki.roblox.com/index.php?title=Table#pairs http://wiki.roblox.com/index.php?title=API:Class/Instance/GetChildren
|
|
|
| Report Abuse |
|
|
|
| 29 Apr 2017 11:05 AM |
for i, v in pairs(workspace.WinLight:GetChildren()) do if game.Lighting:GetMinutesAfterMidnight() == 6 * 60 then v.Material = Enum.Material.Plastic v.Transparency = 1 end
if game.Lighting:GetMinutesAfterMidnight() == 18 * 60 then v.Material = Enum.Material.Neon v.Transparency = 0 end end
i made this but still doesn't work |
|
|
| Report Abuse |
|
|