SOLVED - Check answers.
I am trying to create a darkening effect on a button when you press on it, similar to that of roblox's AutoButtonColor property. However, when I try to set the background colour (backgroundcolour3), it immediately changes to white, no matter the input in the parameters. Here's my localscript:
local buttons = script.Parent.Buttons
local research = script.Parent.ResearchUI
buttons.Frame.Research.MouseButton1Up:Connect(function()
local debounce = false
buttons.Frame.Research.BackgroundColor3 = Color3.new(232, 189, 136)
if debounce then
wait()
else
if research.Enabled == true then
research.Enabled = false
else
research.Enabled = true
end
end
debounce = true
wait(0.1)
buttons.Frame.Research.BackgroundColor3 = Color3.new(255, 208, 149)
end)
I don't get any errors in console, and everything seems to working completely fine. It happens on both the background color changes. Any suggestions?

8 comments
Hello, first mistake I see is .MouseButton1Up, instead of .MouseButton1Down, this shouldnt play a role but idk ;(
And try to use just .BackgroundColor, without that 3
MouseButton1Up works the same way as Down, except up only functions after you stop clicking, so if you're holding the click it won't click.
And I did try .BackgroundColor but that's only brick color so that doesn't work with the RGB values.
Yep, I know I just thought its a mistake because you wrote "when I press on it". Isnt line 18 the white color?
If it is, you got too low cooldown there
I commented everything inside the on mouse click function except for the first background color change and it still turns white when I click it, so it is something to do with line 6 and 18 on the actual change of color.
Huh?