Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I check if a GUI has a certain background colour?

I want to check whether a GUI I have has a certain background colour, but I tried to use color3 but it doesn't seem to work. If anyone could tell me something that I am doing wrong, that would be great. Here is my code:

for i,v in pairs(foodCatagories) do
	v.MouseButton1Click:Connect(function()
		if v.BackgroundColor3 == Color3(0,255,255) then 
			print("Hello")
		end
	end)
end



2 answers

What IceAndNull said is correct, but for GUI elements you wan't to use Color3.FromRGB() so

if v.BackgroundColor3 == Color3.fromRGB(0,255,255) then

Instead of using Color3(0,255,255) it’s Color3.new(0,255,255)

Edit: as kaspar1230 pointed out, use Color3.fromRGB(0,255,255) instead of Color3.new()

This discussion is preserved as it was. New answers, comments, and votes are closed.