Editing Armor Stand Properties

Is it possible to change the lifetime of an armor stand like an item? Such as whenever it is placed, it dies two seconds after. I have already searched on Google, but didn't find anything.
Best Answer
Since Armor Stands don't have a natural despawn condition this can be done using scoreboards.
First execute this command once for setup:
/scoreboard objectives add despawn dummy DespawnTimer
This sets up a new dummy stat called DespawnTimer.
Next, set up a fill or setblock clock and attach 2 command blocks to it. Put these commands in the blocks:
/scoreboard players add @e[type=ArmorStand] despawn 1
/kill @e[type=ArmorStand,score_despawn_min=40]
This will increase the "despawn" score of all armorstands once per tick (1/20 second) and kill the armorstand after 40 or more ticks (40/20 or 2 seconds).
Pictures about "Editing Armor Stand Properties"



How do you customize armor stands?
How to useHow do you use the armor stand editor?
Bedrock Exclusive: Armor Stands can change poses, either by sending a Redstone signal into it, or by pushing the Pose button (available when crouching and looking at the Armor Stand).Armor Stand Editor Tutorial
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Andrea Piacquadio, Skylar Kang, Enric Cruz López, Gary Barnes