How to make spawn set for players

so im a beginner and i tried some obby spawn set it does work as long as ur in the game and never leaves, here is what im trying to do, so i want a part that when a player touched it, it will be the players new spawn point, the thing is, i want that spawn point to be set even when u leave the game so that when the player joins the game again, he will spawn in that location

1 Like

You can try when a person leaves the game to save his data in the datastore (CFrame of the stage) and when he enters the game to load the CFrame to put the player’s position on what you have saved

Player.CharacterAdded:Connect(function(char)
   local Checkpoint = workspace.Checkpoints:FindFirstChild(Player.leaderstats.Stage.Value)
   if Checkpoint then
      char.HumanoidRootPart.CFrame = Checkpoint.CFrame
   end
end)

Everything else you need to do is to save stage to DataStore when player leaves.

Note: you need to adjust this code for your game.