|
| 04 Jul 2016 03:24 PM |
| Is there anyway to make all the parts in the game the same color all at once? |
|
|
| Report Abuse |
|
|
|
| 04 Jul 2016 03:25 PM |
with a script i mean, like, click a button and it all changes
|
|
|
| Report Abuse |
|
|
|
| 05 Jul 2016 05:32 AM |
So, if you are talking about a Gui button then this is how it would go:
local parts = game.Workspace:GetChildren()
for i, v in pairs(parts) do if v:IsA("Part") then v.BrickColor = BrickColor.new("Really red") end end
That should change them. Also, if you have a specific name for the parts like, ChangeColor then you could change if v:IsA("Part") then to if v.Name == "ChangeColor"
But I hope this helped, or at least pointed you in the right direction! |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2016 05:33 AM |
Fixed code:
script.Parent.MouseButton1Click:connect(function() local parts = game.Workspace:GetChildren()
for i, v in pairs(parts) do if v:IsA("Part") then v.BrickColor = BrickColor.new("Really red") end end end)
I forgot to make it a function, also if it is a gui button then make sure this is in a LocalScript |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2016 05:36 AM |
If you're talking about a brick with a Click Detector:
This will also check models for parts too in case you have models with parts
script.Parent.ClickDetector.MouseClick:connect(function() for _, v in pairs (workspace:getChildren()) do if v:IsA("Part") then v.BrickColor = BrickColor.new("Black") elseif v:IsA("Model") then for _, x in pairs (v:getChildren()) do if x:IsA("Part") then x.BrickColor = BrickColor.new("Black") end end end end) |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2016 05:40 AM |
Actually forget that last script, why have it only search layer 1 models? What if you have models inside of models because you're organized?
Color = "Black"
function findParts(location) for _, v in pairs(location:getChildren()) do if v:IsA("Part") then v.BrickColor = BrickColor.new(Color) elseif v:IsA("Model") then findParts(v) end end end
findParts(workspace)
script.Parent.ClickDetector.MouseClick:connect(function() findParts(workspace) end) |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2016 06:02 AM |
| Lol, I didn't do the click detector one because I didn't know it was basically the same. I never use ClickDetectors. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2016 06:04 AM |
| The only reason I know of Click Detectors is because GUIs were too intense for me in 2010. |
|
|
| Report Abuse |
|
|