A concept for a game with a unique gimmick

I started playing a game I haven’t played for years and I find it interesting…

The game makes you control a person who has to get to their goal. But when the person reaches their goal, time goes back to the starting point, and then your point of view is shifted to another person who has to get to another goal.
The person you controlled before is still there, but now you control this other person, while the person you formerly controlled repeats what you did back when you controlled them. Sort of like recording and playing back your actions.
The game repeats this until it becomes chaos, and that’s what I like about it.

I would try to make this in roblox, but I literally have no clue how to record the players actions, let alone even making the basic mechanics for the goals and people.

(its night for me right now so don’t expect a reply just yet)

This probably won’t be the best answer, but make an invisible path behind the player, get the player’s avatar and add it as an npc, make the npc follow the invisible path, repeat that.