Teleport a player back to the place they came from

Is it possible to teleport a player that was teleported to my game from another game back to their original game?

If possible, returning them to their place ID would be better.

There is a way!

Upon the player joining a game, you can capture any ‘Join Data’

Here is where you can find the documentation on it!

And here is how I implemented it into my game. Keep in mind, I also send custom JoinData. See the documentation to see exactly what is sent (i.e. SourcePlaceId).

You’d utilize this join Data by capturing the PlaceId they originated from (if they have one) and use
TelportService:TeleportAsync(placeId,{Players},teleportOptions or nil)

	local function PrivateServerFunction()
		local joinData = Player:GetJoinData()

		local function isPlaceIdApproved(placeId)
			local approvedPlaceIds = {6310162389,3368207972}
			if table.find(approvedPlaceIds,placeId) then
				return true
			else
				return false
			end
		end

        if isPlaceIdApproved(joinData.SourcePlaceId) then
	        local teleportData = joinData.TeleportData
	        if teleportData then
		        local placecode = teleportData.reserveserver
		        local servername = teleportData.reservename
		        local serverdescription = teleportData.reservedescription
		        local password = teleportData.reservepassword
		        local othercode = DS:GetAsync(Player.UserId.."-ReservedServersv2")

		        local isReserved = game.PrivateServerId ~= "" and game.PrivateServerOwnerId == 0	
		
		        ReservedCodes.updateDSS = true
            end
	    end
    end
1 Like

What do I change approvedPlaceIds to?

This is just an example of what I did.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.