0

# How do i color a whole model within a script?

Hey there, i was wondering how do i color a whole model within a script?

Please tell me where the script should we, what type of script. And the script, thank you!!

0
Edited 7 days ago

I'm super noob at scripting but I think you can do :

local model = script.Parent
local children = model:GetDescendants() --first we get the descendants
for i , v in pairs(children) do --we loop through them
if v:IsA("BasePart") then -- we check if it's a part
v.Color = color3.new(1,0,0) -- we give them a color (red in this case)
end
end


There we go. Put it as the model's children Use a script (not a localscript nor a modulescript)

Note : a basepart is a class that contains everything that is a "part" (part,meshpart,wedgepart,terrain, and many more). You can go check this in the developper hub. I hoped this helped you !

for i,v in pairs(workspace.Model:GetChildren()) do