Making multiple buttons change colour and restore it after timer

I am trying to make buttons change colour and disable themselves after they are pressed for a few seconds. This is to show that they have been pressed.
The problem I am having is that if there are several buttons and they are pressed in succession the first button does not restore the state.

I’ve tried to do the following:

I also tried doing it through a function that stores the button and its background and then calls an event with those parameters. I am finding that the variables are not per function call, so subsequent function calls override the variables.

Do I have to create a button widget with its own logic for this to work?

Is this a limitation of Blueprints? In C++ I would imagine I can cache a variable and set a timer with the cached parameters and they will be passed as values. But, it seems to be that in blueprints they are not passed to the function immediately.

Thanks

Hey @MaxCambs
the delay is the problem. You could do it like this:

@L1z4rD89 What about if I want to keep the original colour? Each button is a different colour. Will it work?

Here is the solution to get the colour to be cached per button

1 Like