If all you want is for the player to respawn at the last checkpoint that she touched, you can simply store a value for the player’s position every time you touch a checkpoint (using some kind of trigger in whatever game engine you’re using) and then when the player dies move her back to said stored position.
This does have the implication of if the player reverses back through the level, they will still respawn at the last checkpoint they triggered, not the one closest to the end of the level. This could be intended behaviour or not, depending on the game you are making.
Edit: missed the part where you said you were using Godot. You can detect collisions with a checkpoint trigger by creating an Area2D node and having a script on it with the _on_Area2D_area_entered
function overloaded. From this function you can set your player’s (a global, maybe?) last checkpoint position.