Help with previous place teleporter

I’m making an MMORPG in which there are multiple worlds stored in different places. There is a loading screen game in which it is supposed to teleport the player to the last world that they were in. If the last place data is nil it will teleport them to the beginner town. The main script is a client script so I am not really sure how I would make this system work.

1 Like

You would have to utilize datastores. Whenever a player joins a certain place it saves the PlaceId (using setAsync) to the datastore. Than whenever the player joins the “loading screen game”, access that datastore and use teleport service to teleport them to the place.

If they have no data (nil) then you can do what you mentioned and teleport them to the beginner town and save the beginner town placeId to the datastore. Note that the datastore request have to be handled on the server. You can also simplify things and handle the teleporting on the server as well instead of having to fire remote events to send data to the client.

Hopefully this gives you some insight and goodluck!

Player:GetJoinData() can be used to get the source place of a teleport.