-
What do you want to achieve? Change the color of all the parts with a specific color, no matter where they’re in the workspace
-
What is the issue? I’ve checked several other posts, but the results that i end up with told them to put said parts in a folder, which i don’t want to do, even though it’s easier.
-
What solutions have you tried so far? Mentioned before, I didn’t find a forum that awnsers my specific question.
Have you tried using Instance:GetDescendants(), and then making sure the value
in for key,value in Instance:GetDescendants()
is a Part with Instance:IsA()?
i don’t know how i can use the example scripts from the documentary for my scripts, it doesn’t seem to help me a lot
Just compare the colours.
--examples
local targetColour = Color3.fromRGB(255, 170, 0)
local newColour = Color3.fromRGB(0, 85, 255)
for _, part in next, workspace:GetDescendants(), nil do --for each instance in the workspace
if not part:IsA("BasePart") then continue end --ignore non-BasePart parts (include meshes, CSG, etc.)
if part.Color == targetColour then --if the colour matches the one you want to replace
part.Color = newColour --replace the colour with the new one
end
end
If you’re using BrickColor
s, just do part.BrickColor
instead of part.Color
.
1 Like
My bad, I read your question completely wrong. The methods I provided should still help with the 2nd point, and the code 12345koip gave should work.
1 Like
That worked, thank you very much!
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.