Hey, everyone!
I’ve been trying to get a brick to change color when clicked, and then change back to the original color when clicked again.
I’ve figured out how to do the first part (YouTube Video), but I don’t know, and can’t find, the other half.
Current Script:
You could save the part’s original color at the start of this script and use a debounce to know which mode it is set in, like so:
local color = script.Parent.BrickColor
local debounce = false
script.Parent.ClickDetector.MouseClick:Connect (function()
if not debounce then
script.Parent.BrickColor= BrickColor.Red()
debounce = true
else
script.Parent.BrickColor = color
debounce = false
end
end)
script.Parent.ClickDetector.MouseClick:Connect (function()
if script.Parent.BrickColor = BrickColor.Blue() then
script.Parent.BrickColor= BrickColor.Red()
else
script.Parent.BrickColor= BrickColor.Blue()
end
end)