How can i check if colors are equal

I have a part and have set it to a specific BackgroundColor3 and i want to check if it’s the same but doesn’t work by doing

local BrickColor = Color3.fromRGB(20,53,85)
if game.Workspace.Part.BackgroundColor3 ~= BrickColor then
blah blah blah

And even if the color is equal it still executes the code

You need to change BackgroundColor3 to Color, I’m assuming

local brickColor = Color3.fromRGB(20,53,85)

if game.Workspace.Part.Color == brickColor then
-- code here

Basically I’m a little confused by your example here

Parts don’t have a BackgroundColor3??? So you’d need to do BrickColor instead

local Color3_Selection = Color3.fromRGB(20,53,85)
if game.Workspace.Part.BrickColor == then -- It'll round it to the nearest brickcolor it can find

Also ~ is not, so idk if you knew what you were doing but you were basically doing

if BrickColor1 not equal to BrickColor2 then
– some magical code