Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why won't this brick color changing script work? [closed]

Asked by
Nidoxs 190
8 years ago
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()

Locked by IcyEvil, BlackOrange3343, and 2eggnog

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

2 answers

Log in to vote
3
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

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
Ad
Log in to vote
0
Answered by
IcyEvil 260 Moderation Voter
8 years ago

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()