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?
I solved it for anyone else who has this and needs to fix it. Since RGB values (Color3) are out of 255, when writing out a color3 value, / by 255. For example:
..BackgroundColor3 = Color3.new(255,152,111)
..BackgroundColor3 = Color3.new(255/255,152/255,111/255)
Hope this helps anyone!