Make a button change its color after being hovered and clicked.

I’ve had huge trouble making my DButton change its colour when I hover my mouse over it and change its colour again when it is pressed/held down, anyone knows how to do it?

-Thanks!

PANEL:Paint

Panel:IsHovered

DButton:IsDown

Thanks, I got it to work by using the OnCursorEntered and OnCursorExited

It can be done in the

PANEL:Paint function alone using the functions Synix linked.

If you need an example;


DButton.Paint = function( self )
     if self:IsHovered() then
         -- draw highlighted shit
     else
         -- draw shit
     end
end