What would be the best way to get all of the colors within a model and create a table?
I’m making a custom character recoloring system.
I have all the parts named as their partcolor, the idea is a gui populates with each color contained within the model and you click on these colors to change them with a color 3 gui.
It’s pretty straightforward, I’m just wondering what the best way to go about collecting each present color would be.
what kind of best way are you looking for
you can just iterate through the parts and put their colors in a table
It’s just a simple for each loop.
local function GetAllColors(model : Model)
local currentColors = {}
for _, part : Part in pairs(model:GetDescendants()) do
if part:IsA("BasePart") then
if not table.find(currentColors, part.BrickColor, 1) then
table.insert(currentColors, part.BrickColor)
end
end
end
return currentColors
end
print(GetAllColors(workspace.House))
Example Output of Classic Roblox House
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.