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

Why won't this brick color changing script work?

for i,v in pairs(script.Parent:GetChildren())do
if v:IsA("BasePart")then	
	if v.BrickColor == "Deep orange" then
		v.BrickColor = BrickColor.new("Medium stone grey")
	end
  end
end
script:Destroy()

2 answers

✓ Accepted answer

Since "Deep orange" is a string and not a BrickColor, it is not equal to a BrickColor. To fix this, use either of the following:

if v.BrickColor.Name == "Deep orange" then

or

if v.BrickColor == BrickColor.new("Deep orange") then

Well the term "Deep orange" is a string and not a general color so you cant do that...

for _,v in pairs(script.Parent:GetChildren()) do
if v:IsA("BasePart") then
if v.BrickColor = BrickColor.new("Deep orange") then
v.BrickColor = BrickColor.new("Medium stone grey")
end
end
end
script:Destroy()

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