I have a folder in workspace called Trees and then a couple models in the folder called “Tree”
I’m just trying to make it so when I run a command in the command bar it changes the “Part”'s Colour to whatever colour I enter in the script at the time.
I’ve tried looking for simullar scripts but haven’t found anything. Can anyone help?
local treesFolder = game.Workspace.Trees
local desiredColor = Color3.fromRGB(255, 0, 0)
for _, treeModel in pairs(treesFolder:GetChildren()) do
if treeModel:IsA("Model") then
for _, part in pairs(treeModel:GetDescendants()) do
if part:IsA("Part") and part.Name == "Part" then
part.BrickColor = BrickColor.new(desiredColor)
end
end
end
end
I’ve tested it and it works, just gonna look around my map to see if its done it all.
local folder = -- put ur folder here
local function changeColor(part)
if part:IsA("Part") then
part.BrickColor = BrickColor.new(Color3.fromRGB(255, 0, 0))
end
end
for _, model in ipairs(folder:GetChildren()) do
if model:IsA("Model") then
for _, part in ipairs(model:GetDescendants()) do
changeColor(part)
end
end
end
Something a tiny bit similar but different from using the “Selection”
local treesFolder = game.Workspace.Trees
local desiredColor = Color3.fromRGB(255, 0, 0)
for _, treeModel in pairs(treesFolder:GetChildren()) do
if treeModel:IsA("Model") then
for _, part in pairs(treeModel:GetDescendants()) do
if part:IsA("Part") and part.Name == "Part" then
part.BrickColor = BrickColor.new(desiredColor)
end
end
end
end