It works ! but when you are at the initial position, players go to x.0 y.0. How can i avoid to do that ? if you spam Undo.
I do not understand what you mean by this. If there is no history (History X size = 0), then the undo event will not run for that object.
Or the player and objects delete itself
As I mentioned in the comments, don't delete the object if you want to preserve it's history. If you delete the object, the history array will no longer have an object associated with it. Just move it off screen, make it invisible, or otherwise disable it.