Hello. I have a model called paintparts. There are a bunch of parts called paint. I want to change the color of them all through a script without having to write a code for every single one of them. Is there a more efficient way to change the color of them?
Yes, it's called a loop.
local model = workspace.somemodel; local color = BrickColor.new("Red"); local HB = game.RunService.Heartbeat; for _, child in pairs(model:GetChildren()) do child.BrickColor = color; -- Set the color if(_==0) then HB:wait(); end -- Wait every 10 iterations, Instead of each iteration, so it changes all the part's colors faster but won't lag if the model has a very large number of parts. end
http://wiki.roblox.com/index.php?title=API:Class/Instance/GetChildren