Why is this returning false when both values are equal?

maybe some are left unchanged because their colors are too different? try outputting things and sharing your code for debugging

Can you print out the ClassName of
print(workspace.CountryData[countryName].C3.ClassName)

I know what C3 is. It is a Color3value.

Ik but your error is attempt to index boolean so Im just curious

Read above, fixed that. >>chars

So your thingy should be fixed now, right?

No it is not. Just that specific line >>char limit chars

Edit: just hit the 1 hour reply limit.

Same issue. Just that line specifically has been fixed, which still has the same issue.

I increased the epsilon and it doesn’t change the end-result. @au_tk

@4SHN I’m not comparing red with blue. The red city has no relation to the problem
@weakroblox35 I am using attributes for this. The issue is that theres more than 3200 meshparts and cities; this means any more and the game is unplayable for many devices.

This means I have to allow some countries to share provinces. That is why I have to check if the province is a certain colour, in order to check if it is owned by the player country.

What’s wrong now?
chatararrarsrars

following up on this for later ^ J9 stated the issue in the post above this
cc @au_tk

Oh, wouldn’t you just increase the epsilon?

J9 needs to give more details in that case
they might be trying to match red with blue and wondering why it’s false even with the FuzzyEq

If I understood correctly, everything is the same color; red.

Just use attributes for this please.
if Province:GetAttribute("Country") == Player:GetAttribute("CurrentCountry") then

2 Likes

I am using attributes for this. The issue is that there’s more than 3200 meshparts and cities; this means any more and the game is unplayable for a few devices.

For devices that could manage to get past this, it will be incredibly performance-heavy and unoptimised. In fact, the only reason I’m reprogramming this code is because earlier it’d take way too long just to select your country, let alone play it.

Since I can’t add any more meshparts and cities (otherwise the game would be a mess, which defeats the purpose of me trying to optimise it); this means I have to allow some countries to share provinces. That is why I have to check if the province is a certain colour, in order to check if it is owned by the player country.

I am using attributes to get the region based on city. I can’t do it the other way round since I’ve already tried that and the issue is; how am I meant to actually set the attribute “city” as the city that owns the region? I have to do some calculations, which is what this script is for.

No. Each country has a different colour, each province and city shares the same colour as the country

No. I checked the colour in my else statement. It is exactly the same. Even with FuzzyEq, many provinces dont match up even though the colour is EXACTLY the same.

I have. Still not matching up.

can you show the code? also, could you output the values that don’t match and what they’re supposed to match?
screen recording is probably easier

if region and region.Color==workspace.CountryData[countryName].C3.Value then
	region.Color=Color3.new(1.0, 1.0, 1.0)
end

this is all it is now, still doesnt work. Region is valid, by the way

this could work

local function areColorsEqual(colorA, colorB, epsilon)
				local epsilon = epsilon or 0.001

				if math.abs(colorA.R - colorB.R) > epsilon then
					return false
				end

				if math.abs(colorA.G - colorB.G) > epsilon then
					return false
				end

				if math.abs(colorA.B - colorB.B) > epsilon then
					return false
				end

				return true
			end
			if areColorsEqual(colorA,colorB) then
				--code
			end