Teleporting to a private server

try this, TPS:Teleport(11873076445, placeId, isPlayer) or TPS:TeleportAsync(11873076445, placeId, isPlayer)

still says unable to cast value to objects

I now understand,

dont do this, instead just make a table where i’ll teleport the players. Insert userid of players in the table cuz its more specific

how tho. its the only method ik

Make a new table, insert this into table table.insert(IsPlayer, Player.UserId then next is
TeleportService:TeleportPartyAsync()

1 Like

didn’t work… can you please send the code

local Part = workspace["Elevator 2p left"].Teleport.Telepart

workspace["Elevator 2p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 2p left"].Teleport.Telepart end)
workspace["Elevator 3p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 3p left"].Teleport.Telepart end)
workspace["Elevator 4p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 4p left"].Teleport.Telepart end)
workspace["Elevator 5p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 5p left"].Teleport.Telepart end)
workspace["Elevator 6p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 6p left"].Teleport.Telepart end)
workspace["Elevator 1p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 1p left"].Teleport.Telepart end)

workspace["Elevator 2p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 2p"].Teleport.Telepart end)
workspace["Elevator 3p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 3p"].Teleport.Telepart end)
workspace["Elevator 4p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 4p"].Teleport.Telepart end)
workspace["Elevator 5p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 5p"].Teleport.Telepart end)
workspace["Elevator 6p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 6p"].Teleport.Telepart end)
workspace["Elevator 1p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 1p"].Teleport.Telepart end)

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


local idPlace = 11873076445


-- RESERVED SERVER DATA
local code
local pvSVid

-- DEBOUNCE IF SERVER ALREADY EXIST
local isServerExist = false

local player = ""
-- PLAYERS WHO ALREADY TRIGGERED THE TOUCH
local PlayersActivatedTouchTP = {}

function connnect(partTouched)
	local isPlayer = game.Players:FindFirstChild(partTouched.Parent.Name)
	if not isServerExist then
		local placeId = TPS:ReserveServer(11873076445)
		TPS:TeleportAsync(11873076445, placeId, player)
		Part.CanTouch = false
		isServerExist = true
	end end

function private(partTouched)
	for i = 1,12 do
		if partTouched.Name == "HumanoidRootPart" then
			local isPlayer = game.Players:FindFirstChild(partTouched.Parent.Name)
			if isPlayer then
				if not table.find(PlayersActivatedTouchTP, isPlayer) then
					table.insert(PlayersActivatedTouchTP, isPlayer)
					if Players:GetPlayerByUserId(isPlayer.UserId) then
						print(isPlayer)
                                                player = isPlayer.UserId
						wait(1)
						connnect(partTouched)

					end
				end
			end
		end
	end


end


workspace["Elevator 2p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 3p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 4p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 5p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 6p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 1p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 2p"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 3p"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 4p"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 5p"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 6p"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 1p"].Teleport.Telepart.Touched:Connect(private)

the same error… im so tired of this script tbh

try this


local teleportOptions = Instance.new("TeleportOptions")
local Part = workspace["Elevator 2p left"].Teleport.Telepart

workspace["Elevator 2p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 2p left"].Teleport.Telepart end)
workspace["Elevator 3p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 3p left"].Teleport.Telepart end)
workspace["Elevator 4p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 4p left"].Teleport.Telepart end)
workspace["Elevator 5p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 5p left"].Teleport.Telepart end)
workspace["Elevator 6p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 6p left"].Teleport.Telepart end)
workspace["Elevator 1p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 1p left"].Teleport.Telepart end)

workspace["Elevator 2p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 2p"].Teleport.Telepart end)
workspace["Elevator 3p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 3p"].Teleport.Telepart end)
workspace["Elevator 4p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 4p"].Teleport.Telepart end)
workspace["Elevator 5p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 5p"].Teleport.Telepart end)
workspace["Elevator 6p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 6p"].Teleport.Telepart end)
workspace["Elevator 1p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 1p"].Teleport.Telepart end)

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


local idPlace = 11873076445


-- RESERVED SERVER DATA
local code
local pvSVid

-- DEBOUNCE IF SERVER ALREADY EXIST
local isServerExist = false

local player = ""
-- PLAYERS WHO ALREADY TRIGGERED THE TOUCH
local PlayersActivatedTouchTP = {}

function connnect(partTouched)
	local isPlayer = game.Players:FindFirstChild(partTouched.Parent.Name)
	if not isServerExist then
		local placeId = TPS:ReserveServer(11873076445)
		TPS:TeleportAsync(placeId, {player}, telepoortOptions)
		Part.CanTouch = false
		isServerExist = true
	end end

function private(partTouched)
	for i = 1,12 do
		if partTouched.Name == "HumanoidRootPart" then
			local isPlayer = game.Players:FindFirstChild(partTouched.Parent.Name)
			if isPlayer then
				if not table.find(PlayersActivatedTouchTP, isPlayer) then
					table.insert(PlayersActivatedTouchTP, isPlayer)
					if Players:GetPlayerByUserId(isPlayer.UserId) then
						print(isPlayer)
                                                player = isPlayer.UserId
						wait(1)
						connnect(partTouched)

					end
				end
			end
		end
	end


end

isn’t it the same code? it doesn’t work btw

I changed it abit, try again because i realise you pout the parameters in the wrong order

1 Like

unable to cast string to int64

change the UserId to a name, player = isPlayer.Name

weird, still shows same error…

Try this, player = 0 then do this, player = IsPlayer.UserId

1 Like

nope, still same error… I have no idea what to do tbh

same, I think it’s hard this normally worked for me

you can teleport more than a one player using TeleportPartyAsync()
I think you have the arguments wrong in the replies though
try this instead:
TPS:TeleportPartyAsync(11873076445, PlayersActivatedTouchTP)
also the you’re creating a new part variable for each function locally instead of changing the global one so you should remove local from local part inside the functions, besides that I would recommend a for loop that loops a function through all the parts that get touched instead of creating an individual function for each
also instead of this:
local isPlayer = Players:GetPlayerFromCharacter(partTouched.Parent)
use this:
local isPlayer = game.Players:GetPlayerFromCharacter(partTouched.Parent)

I hope this helps.

While trying to reserve a server with the location ID 11873076445, the connnect(partTouched) method does not store the outcome of the ReserveServer function in a variable. Instead, it is attempting to teleport to the server right away using the location ID in place of the server ID. The server ID must be used to teleport to the server and is returned by the ReserveServer method.

Three arguments are needed for the TeleportToPrivateServer function: the place ID, the server ID, and the players who will be teleported. The players to teleport are sent as the second argument in the code you provided, however they should actually be the third argument.

A boolean value indicating if the teleport was successful and a result code are the two values that the TeleportToPrivateServer method returns. The call to TeleportToPrivateServer is wrapped in the pcall function, but neither the return code nor its storage are used.

After the teleport, the Part.CanTouch property is being changed to false, although it’s unclear from whence Part originated or what it stood for.

There is a 12-iteration loop in the private(partTouched) method, but it is unclear what it does.

Tell me if any of the steps above solved your issue.