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

Colors not working as expected?

Asked by 5 years ago

I'm sorry, this is a really basic question but something weird is happening with colors. I'm making a part that displays a teams color directly from a brickcolor variable that is the teams color. When this script runs, I get an error that says bad argument #1 to 'new' (Color3 expected, got BrickColor). I'm sorry again, this is my first time ever picking up a script so thanks for any help given.

while wait() do
    wait(.5)
    script.Parent.BrickColor = BrickColor.new(script.Parent.Parent.Parent.Parent.TeamColor.Value)
end

4 answers

Log in to vote
0
Answered by
Voy1980 111
5 years ago

A BrickColor value is already a brickcolor. Therefore, you do not need to add a new brickcolor. Literally just take the value and set it equal to the property of the brick.

while true do
    wait(.01)
    if script.Parent.BrickColor ~= script.Parent.Parent.Parent.Parent.TeamColor.Value then
    script.Parent.BrickColor = script.Parent.Parent.Parent.Parent.TeamColor.Value
    end
    end
Ad
Log in to vote
0
Answered by
popeeyy 493 Moderation Voter
5 years ago

I tested this out, and I believe this should work.

while wait(.5) do
    script.Parent.BrickColor = script.Parent.Parent.Parent.Parent.TeamColor.Value
end

There's no need to make a new BrickColor because the TeamColor is already a BrickColor.

Log in to vote
0
Answered by 5 years ago

If you are using a Color3Value for the TeamColor value, then you would need to use Color3 instead of BrickColor to change the color...

script.Parent.Color = Color3.new(script.Parent.Parent.Parent.Parent.TeamColor.Value)

You can't use Color3 values for BrickColors or BrickColors for Color3s.

Log in to vote
-2
Answered by 5 years ago
Edited 5 years ago

You used BrickColor instead of Color3. And when you are using Color3, u can not use BrickColor.

while true do
    wait(.5)
    script.Parent.Color = Color3.new(script.Parent.Parent.Parent.Parent.TeamColor.Value)
end

**NOTE: **If this would not work, add more details and message me!

Answer this question