Problem with the basics color3

I run into issues with the basics color3 and i find it difficult to make it right.
1.

  • I’m tried to make a script that changes clothes color to dark

2.

  • I’m ran into the issues that it attempts to compare userdata, i tried other ways but i gave up .

3.

  • I’m couldn’t find it on developer hub.

Here the script that’s supposted to make clothes dark

        if cloth:IsA("Shirt") or cloth:IsA("Pants") then
			local limit = Color3.fromRGB(100,100,100)
			local getbright = cloth.Color3
			if (limit > getbright) then
				local getbright = cloth.Color3 - Color3.fromRGB(40,40,40)
				cloth.Color3 = getbright
			end
		end

You can’t compare Color3’s because as the error said they’re Userdata! Instead you can compare the components individually:

if (limit.r  > getbright.r) and (limit.g > getbright.g)  and (limit.b > getbright.b)  then

Also you need to subtract the Color3’s Differently as well, because you’ll get an error for that too

1 Like