Respawn on last location (Help)

Been searching for more than an hour now and still not found an working script to be able to respawn on the last location. Can someone give a link or file that i can download which is working? Thanks