Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a teleport go back to the original position?

My game has LOADS of teleports in it. How do I make it so when a player teleports back to the main game it puts them in the same position they were in?

3 comments

1

Use data stores

0

You need to keep track of their original positions in each game.

0

like @tiraner300 said, data stores needs to be used.

1 answer

Pack the player's position into a dictionary of player data that you save, and when you load it, I recommend finding the nearest spawn preset position from where they left the game at. The reasoning behind this is that you should ask yourself what happens if a player gets stuck somewhere.

This article will help you with the DataStore aspect: http://wiki.roblox.com/index.php?title=Saving_Player_Data

Note that, unlike that article, you do not need to save data when a player joins, you should attempt to save all player data when the server shuts down with game:BindToClose(), and you should check if the attempt to load a player's data errored or not before saving.

This discussion is preserved as it was. New answers, comments, and votes are closed.