Automatic respawn at near death location


I have no experience with coding and I’m nearly done with this server I’m setting up for me and my friends. This one thing is all I needed to get done, which is how would I able to get players automatically respawn really close to there last death location (To avoid spawn killing)

I have done everything else I’ve wanted to get done, but this part has blocked me for days.

If anyone could help me with this, that would be much appreciated.