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

How to make an if statement for a BrickColor property?

Asked by 4 years ago
Edited 4 years ago

I want to be able to run a code, when a certain part has the BrickColor called "Hot pink". How would I change the script below in order to do that?

if script.Parent.BrickColor == "Hot pink" then
--[piece of code]
end

1 answer

Log in to vote
0
Answered by
oreoollie 649 Moderation Voter
4 years ago

BrickColor is not a string, you have to compare it to BrickColor.new("Hot pink")

if script.Parent.BrickColor == BrickColor.new("Hot pink") then
    -- Code
end

If my answer solved your problem please don't forget to accept it.

0
It worked. Thank you very much for answering so fast. ViktorRamstrom 15 — 4y
Ad

Answer this question