Error while changing color

Hello so I am trying to make it so when a keycard touches a part it turns the color of something. Here is the script:

script.Parent.Touched:Connect(function(hit)
   if hit.Parent.Name == "KeyCard" then
       alarm1.Color = "67, 151, 6"
       wait(3)
       alarm2.Color = "67, 151, 6"
   end
end)

And here is the error. Workspace.Model.Key.Keytaker.Script:27: invalid argument #3 (Color3 expected, got string)

1 Like

Yeah, you’re using a string. Use the Color3 constructors: Color.new, Color3.fromRGB, etc.
For example:

alarm1.Color = Color3.fromRGB(67, 151, 6)
alarm2.Color = Color3.fromRGB(67, 151, 6)
2 Likes

u need to give a color3 value , which is like
Color3.new(1,0,0) would be red
Color3.new(0,01) woudl be blue.
but what if we want a RGB? Here…
Color3.FromRGB(255,0,0) would be red
Color3.FromRGB(0,255,0 would be green
hope this helps.