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: Script only effecting one part?

Previous Thread :: Next Thread 
Jakeup10 is not online. Jakeup10
Joined: 29 Nov 2008
Total Posts: 6782
28 Nov 2013 03:34 PM
local colors = {"Bright blue","Bright bluish green","Medium blue","Pastel Blue","Pastel light blue","Deep blue","Navy blue"}

local Ice = Workspace.IceSection:GetChildren()

for i = 1, #Ice do

script.Parent.IceSection.Ice.BrickColor = BrickColor.new(colors[math.random(1,#colors)])

wait(1)
end



I am trying to get a simple script to randomize and change the color of all the parts in a model, for now and future use, but the only part which changed color was one part in the model, over and over. Did I do something wrong? I think it has to do with script.Parent.IceSection.Ice.BrickColor = BrickColor.new, due to how it chose that part, but I'm not sure...Any ideas?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
28 Nov 2013 03:39 PM
ice[i]
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
28 Nov 2013 03:40 PM
Same thing happened to me. Here's the fix:

randombrickcolor = BrickColor.new(colors[math.random(1,#colors)])
inside = script.Parent:GetChildren()

for=1,#inside do
if inside[i]:IsA("Part") then
inside[i]BrickColor = randombrickcolor

wait (1)
end
end
Report Abuse
Andrew1234567mmm is not online. Andrew1234567mmm
Joined: 14 Oct 2009
Total Posts: 691
28 Nov 2013 03:40 PM
Try this and see if this is what you want

local colors = {"Bright blue","Bright bluish green","Medium blue","Pastel Blue","Pastel light blue","Deep blue","Navy blue"}

local Ice = Workspace.IceSection:GetChildren()

for i = 1, #Ice do

Ice[i].BrickColor = BrickColor.new(colors[math.random(1,#colors)])

wait(1)
end

Masked in sight [Nowhere to be found]
Report Abuse
Jakeup10 is not online. Jakeup10
Joined: 29 Nov 2008
Total Posts: 6782
28 Nov 2013 03:45 PM
Yes andrew, that did exactly what I needed! I see how it works now, Ice specifies which part it is as it goes through the parts! This has helped me randomize the colors of ice, but now I shall modify it to color this crazy 20,000 part thing...Thanks!
www.roblox.com/Roblox-Stress-Test-place?id=122968277
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