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: Script doesn't affect all parts.

Previous Thread :: Next Thread 
radusavin366 is not online. radusavin366
Joined: 26 Apr 2012
Total Posts: 32
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
GIassWindows is not online. GIassWindows
Joined: 03 Oct 2016
Total Posts: 285
29 Apr 2017 08:26 AM
script plz


ok
Report Abuse
radusavin366 is not online. radusavin366
Joined: 26 Apr 2012
Total Posts: 32
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 is not online. 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
radusavin366 is not online. radusavin366
Joined: 26 Apr 2012
Total Posts: 32
29 Apr 2017 09:52 AM
ummm...yes?
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
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
radusavin366 is not online. radusavin366
Joined: 26 Apr 2012
Total Posts: 32
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 is not online. 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
radusavin366 is not online. radusavin366
Joined: 26 Apr 2012
Total Posts: 32
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
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