One idea is to record the state of everything into an array and use that to play it back for the demo.
Here’s an example with just one object. Could be a start.
construct.net/en/forum/construct-2/how-do-i-18/replay-meatboy-55099
Another idea is to just record the player input in an array. This is likely what those old arcade games did, but the frame rate was fixed. With construct the frame rate is variable. Even at 60fps each frame can vary a tiny bit which can throw off the reply.
A solution to that is to make your game logic run at a fixed rate. However that can be complicated since events and behaviors aren’t made to do that.