rn i am trying to make a gui that when clicked changes the color of a part. this is the script i have right now
script.Parent.MouseButton1Click:Connect(function(player) game.Workspace.ColorPart.BrickColor = Color3.new(0, 0, 0) end)
but my output just says:
20:01:19.421 - Players.mynam3with123.PlayerGui.ScreenGui.TextButton.LocalScript:2: invalid argument #3 (BrickColor expected, got Color3)
As Feahren already explained perfectly in their comment, you are supplying an invalid datatype to the property you are trying to change.
A part's BrickColor requires BrickColor.new(number val)
However, if you would like to get away from using a BrickColor datatype (I know I do), then you could simply take advantage of the fact that most part objects now have a Color property that can be supplied a Color3 datatype!
Therefore, your new code could look like this!
local GUI_Object = script.Parent local ColorPart = game.Workspace.ColorPart GUI_Object.MouseButton1Click:Connect(function(player) ColorPart.Color = Color3.new(0, 0, 0) end)
I hope this helps!