How do you check if color value is under 30 or above?

Hello guys, I’m fairly new to scripting and how do you check if a color value from rgb is under 30 and above 30?

Hey.

Depends, Color3 values have 3 constructors (R, G, B) you can require them like this:

local color = Color3.fromRGB(50,50,50)
local r = color.R
local g = color.G
local b = color.B

And then you just simply check which one of them you want to check the value of and do this:

if r > 30 then

end
--or
if r < 30 then

end
--or
if g > 30 then

end
--or
if g < 30 then

end
--or
if b > 30 then

end
--or
if b < 30 then

end
1 Like