When cursor is on a button it doesn't change colors as intended

I have 3 buttons. I wanted to make a feature that if a player’s cursor is on a button then it lights up in grey color but it doesn’t work and there are no errors. In each of the buttons there is a localscript and has the same code :

script.Parent.MouseEnter:Connect(function()
	Color3.new(0.321569, 0.337255, 0.345098)			
end)

script.Parent.MouseLeave:Connect(function()
	Color3.new(0, 0, 0)
end)
1 Like

Because you are not doing anything to the button. You should do something like this:

script.Parent.BackgroundColor3 = Color3.fromRGB(20, 30, 40)
2 Likes