How to teleport player from starting place to another place?

Hi!
So I want the player to touch a part and they teleport to a place inside of the starting place.
(Like going from the lobby to being teleported to the main game)

I’ve tried other solutions from other posts but none of them work for me or isn’t my situation. This is the code I have so far:

local part = script.Parent

part.Touched:Connect(function()
	game:GetService('TeleportService'):Teleport(5789355763)
end)

Have you seen the teleportservice documentation? I reckon, go check it out. (I can’t provide links because I am on mobile.)

Hi, i looked at the doc and tries this:

local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")

local TARGET_PLACE_ID = 5789355763

local playerToTeleport = Players:GetPlayers()[1]

TeleportService:TeleportAsync(TARGET_PLACE_ID, {playerToTeleport}, teleportOptions)
1 Like

This isn’t a great way to teleport. I’d reccomend storing the players into a table and teleporting that way

I don’t want to teleport all the players just the one that touches the part


local Part = script.Parent

local TeleportService = game:GetService('TeleportService')

local placeID = 0

local canTP = true

local function otherGame(otherPart)
	local player = game.Players:FindFirstChild(otherPart.Parent.Name)
	if player and canTP then
		print("A")
		canTP = false
		TeleportService:Teleport(placeID, player)
	end
end

Part.Touched:Connect(otherGame)
2 Likes

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