How do i make it so when you leave game. You spawn at your location where you left your game?

When you leave the game and join back you spawn at your last location. How do you script something like that? I tried watching some tutorials but they all didn’t work. My game cannot get developed further if i can’t find how to do this so any help would be appreciated.

6 Likes

Do you know how to use DataStore?
You could store a HumanoidRoot’s CFrame and in which place ID was he in (If the game uses multiple places) and then once the player joins a hub or the main place they get teleported to the position they were at in the place they were at

4 Likes

You would use DataStoreService and save the player’s position when PlayerRemoving or BindToClose is fired.

1 Like

You need to take its characters CFrame and add to the datastore on PlayerRemoving.

1 Like

Watch this video by AlvinBlox, he explained it very well and it should be worth of your time watching https://www.youtube.com/watch?v=vobF8wCyl6U
Yes its all about datastore

Use the Players Service to add a PlayerAdded hook and create a CFrameValue inside of the Player instance. After that, hook up a CharacterAdded hook and check if there is data for there location, otherwise you can just load up a default location, or random location. Your choice.

Inside of the CharacterAdded hook, use the Changed event to store the HumanoidRootPart’s CFrame.

In the PlayerRemoving hook, you simply save the CFrame value,

2 Likes

I suggest making zones, so if the player leaves, because he/she is stuck they respawn at their designated position, by using DataStores.
If you’re making an obby then:

If anyone could provide a script example that would be great