Color command turning me grey?

Hello, I’m making a basic admin commands as a little project and I have this one command where the player is able to change colour with the given set of colours to choose from. Everything works fine as expected and my character is changing colour but it’s not the right colour, my character is turning grey. Any fixes?
RobloxStudioBeta_QZqZsueryu

Code:

		elseif splitMessage[1] == "color" then
				local player = GetPlayer(splitMessage[2], player)
				local Colours = {
					Red = BrickColor.new("Bright red"),
					Blue = BrickColor.new("bright Bright blue"),
					Orange = BrickColor.new("Deep orange"),
					Purple = BrickColor.new("Bright violet"),
					Green = BrickColor.new("Dark green"),
					Yellow = BrickColor.new("New Yeller"),
					Pink = BrickColor.new("Pink")
				}
				
				for _, plr in pairs(player) do
					if plr.Character  then
						
						-- loop every part in the character and change colour
						for _, obj in pairs(plr.Character:GetDescendants()) do
							if obj:IsA("Part") then
								for name, color in pairs(Colours) do
									if splitMessage[3]:lower() == name:lower() then
										obj.BrickColor = BrickColor.new(tostring(name))
										break
									end
								end
							end
						end
						
					end
				end
			end

im not good at the tables but i think it has to do something with the

obj.BrickColor = BrickColor.new(tostring(name))

i guess

I dont think its right to write another Brickcolor.new when the value is already brickcolor try doing

obj.BrickColor = tostring(color)

yeah… didnt saw but i felt something wrong lol
@Free_Br1cks try converting colours into rgb for advanced colors

I’ve found the problem, mistakenly I’ve used the name variable instead of the color one.

I’ve changed:

obj.BrickColor = BrickColor.new(tostring(name))

to:

obj.BrickColor = BrickColor.new(tostring(color))

Try removing the Brickcolor.new aswell cuz i think its not necessary too

try then

elseif splitMessage[1] == "color" then
				local player = GetPlayer(splitMessage[2], player)
				local Colours = {
					Red = BrickColor.new("Bright red"),
					Blue = BrickColor.new("bright Bright blue"),
					Orange = BrickColor.new("Deep orange"),
					Purple = BrickColor.new("Bright violet"),
					Green = BrickColor.new("Dark green"),
					Yellow = BrickColor.new("New Yeller"),
					Pink = BrickColor.new("Pink")
				}
				
				for _, plr in pairs(player) do
					if plr.Character  then
						
						-- loop every part in the character and change colour
						for _, obj in pairs(plr.Character:GetDescendants()) do
							if obj:IsA("Part") then
								for name, color in pairs(Colours) do
									if splitMessage[3]:lower() == name:lower() then
										obj.BrickColor = tostring(color)
										break
									end
								end
							end
						end
						
					end
				end
			end

also can i have the full script cuz im lazy to finding some chat things in toolbox and making hybird of it with many errors

nvm imma go do it xd

obj.BrickColor = Colours[name]

You already have a table of BrickColor values so there’s no need to construct anymore, simply index that table for the required BrickColor value.

yep. were told him about it so… thats useless now