Hello, I'm new to this site and Lua. Okay, lets cut to the chase.
MyPart = script.Parent
function ColorClick ()
MyPart.BrickColor = BrickColor.new("Lime green")
end
MyPart.ClickDetector.MouseClick:connect(ColorClick)
if MyPart == "Lime green" then
function ColorClickTwo ()
MyPart.BrickColor = BrickColor.new("Really red")
end
end
MyPart.ClickDetector.MouseClick:connect(ColorClickTwo)
I am trying to change a red brick to green by clicking it, which works, but now i'm trying to change it back to red by clicking it again. So, i'm basically trying to change the brick color back and forth by clicking it. When I test it, I would click the red brick, and it would turn green. But, when I click it again, it doesn't do anything, and it would say in the output, "attempt to call a nil value".
Sorry if this is a dumb question, but I am new to Lua, and really can't figure this out.
