###Do not quote me on this but here is what I think is happening.
So I did some testy test and found out some interesting things.
First it is important to remember that color3.new() takes in number value from 0 to 1. A color3.fromRGB takes value from 0 to 255.
local Baseplate = workspace.Baseplate;
local Color = workspace.Color;
Baseplate.Color = Color3.new(78/255, 34/255, 100/255);
Color.Value = Color3.new(78/255, 34/255, 100/255);
if Baseplate.Color == Color.Value then
print("Similar!");
else
print("Not Similar");
end;
I inserted a Color3Value on Workspace and currently am testing its value with Baseplate's Color.
When you run the code, you will notice that it prints Not Similar. The problem is that the number/255 gives us decimal numbers. From my understanding, the Color3Value takes in values from 0 to 255.
But if you check the Color3Value's Value when running the game, you will notice that the value is actually the exact same as the one we are assigning with. Do take a look at this Image. If anyone could explain why that is happening, it would be appreciated.
Neverthless, the fix for your code would be to use Color3.fromRGB when assigning values to Color3Value.
local Baseplate = workspace.Baseplate;
local Color = workspace.Color;
Baseplate.Color = Color3.new(78/255, 34/255, 100/255);
Color.Value = Color3.fromRGB(78, 34, 100);
if Baseplate.Color == Color.Value then
print("Similar!");
else
print("Not Similar");
end;
The above example will print Similar.
[EDIT]
@hiimgoodpack had answered that Color3.new() way does not work because floating point errors. The if conditional statement does not run because those two numbers do not exactly match. Credits to hiim.
3 comments
Please use code blocks.
is the "part.Value" a color3value or not
Yes, it obviously is.