Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is There a Way to Make Changes in Your Game Permanent Through Scripting?

Like lets say I have multiple parts, green, in my game and I wanted to change them all to white. It would take me forever to click through all my models and change the parts manually. Is it possible for me to make a script to go through every part and change the color automatically?

1 answer

✓ Accepted answer

Use a for loop in the command bar

for _,v in pairs(model:GetChildren()) do
	v.Color=Color3.fromRGB(255,255,255)
end

If you can't find it click on the views tab of studio and click on command bar

Edit: To get all descendants of the model

for _,v in pairs(model:GetDescendants()) do
	if v:IsA("BasePart") then
		v.Color=Color3.fromRGB(255,255,255)
	end
end

3 comments

0

That would work if the children didn't have children themselves, I need a recursive function to change the colors of the children if the part has any

0

@xXCyberProXx edited answer

0

Ah, Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.