Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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?

1
Use data stores Le_Teapots 913 — 6y
0
You need to keep track of their original positions in each game. MooMooThalahlah 421 — 6y
0
like @tiraner300 said, data stores needs to be used. Axceed_Xlr 380 — 6y

1 answer

Log in to vote
0
Answered by
Avigant 2374 Moderation Voter Community Moderator
6 years ago

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.

Ad

Answer this question