Does Timer work with rules?

My goal is to make an item appear when you press a button, then have it last for a few seconds and then disappear. In short, a buff for the character. So I made:
For the character:
RULE: When all conditions are valid:
-Actor Recieves key 1 is down
-Attribute game.BuffON? is False
--Change Attribute game.BuffON? to TRUE
--Spawn Actor: Shield
---Layer Order: In front of actor
---Direction 0, Relative to Actor
---Position 0,0 Relative to Actor
For the Buff (Shield):
TIMER: Every 2 seconds (Run to completion off)
-RULE: When all conditions are valid:
--Attribute game.buffON? is TRUE
---Destroy this actor
---Change Attribute game.buffON to FALSE
My theory is this: when key 1 is pressed, the boolean attribute game.buffON? is checked. if game.buffON is false, then the shield is spawned on top of the actor.
And then, every 2 seconds, it is checked on whether attribute game.buffON? is true. If yes, then it destroys the shield and sets game.buffON? to false.
...But it doesn't work. The shield doesn't disappear. I think it's the timer problem. The rest of the code doesn't seem to be the problem, because if I make a shield destroying button, it does get destroyed.
Oh, but the shield making button and destroying button has to be seperate. It can't check the attribute to determine whether to spawn or despawn.
Anyway, my main question: What am I doing wrong?
For the character:
RULE: When all conditions are valid:
-Actor Recieves key 1 is down
-Attribute game.BuffON? is False
--Change Attribute game.BuffON? to TRUE
--Spawn Actor: Shield
---Layer Order: In front of actor
---Direction 0, Relative to Actor
---Position 0,0 Relative to Actor
For the Buff (Shield):
TIMER: Every 2 seconds (Run to completion off)
-RULE: When all conditions are valid:
--Attribute game.buffON? is TRUE
---Destroy this actor
---Change Attribute game.buffON to FALSE
My theory is this: when key 1 is pressed, the boolean attribute game.buffON? is checked. if game.buffON is false, then the shield is spawned on top of the actor.
And then, every 2 seconds, it is checked on whether attribute game.buffON? is true. If yes, then it destroys the shield and sets game.buffON? to false.
...But it doesn't work. The shield doesn't disappear. I think it's the timer problem. The rest of the code doesn't seem to be the problem, because if I make a shield destroying button, it does get destroyed.
Oh, but the shield making button and destroying button has to be seperate. It can't check the attribute to determine whether to spawn or despawn.
Anyway, my main question: What am I doing wrong?
Comments