I have a teleporter part in my game that allows the player to move from place to place in the game. But I also want it set up so the game remembers what place they were in last and then use that as a the Place they spawn into instead of the starter place.
local TeleportService = game:GetService("TeleportService")
local Place = 2664772501
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
game.ReplicatedStorage:WaitForChild("FadeInEvent"):FireClient(player)
player.Character.Humanoid.WalkSpeed = 0
TeleportService:Teleport(Place, player)
end
end)
This is how I teleport them. I already have a way of saving the place they teleported to and everything now I'm just wondering of how to set it up so that is where they spawn into when they leave the game and come back again.
I was thinking of simply using the same code when the player comes into the game (starter place) like this:
game.Players.PlayerAdded:Connect(function(player)
local Place = <whatever I saved>
TeleportService:Teleport(Place, player)
Is that a good way of setting it up or is there another better way that I'm not aware of?

2 comments
Yes that's possible, but I wouldn't really call this an answer.
Yeah, I just got it to work this way. I pretty much just save the ID when they hit the teleporter and then do a check on startup to see if the place they are in matches the ID I saved and if not, teleport them to that place.