Respawning near where you died

On GTA 5 Online when you die you will respawn near where you died, sometimes a block away, on the sidewalk. I am trying to figure out how to do the same in FiveM. I was looking through the native reference and I found a few things but they didn’t seem to work perfectly. I found “GetPointOnRoadSide” it gives coords in “vector3” but I can’t seem to get them from it. Any help would be appreciated.

Let me know if you get any resources