Need help teleporting to existing private server

Hello there,

So I am having problems trying to teleport to a existing Reserved Server and no matter what I do it tells me that I’m unauthorized to join. I don’t know what other options there are but I have come to where I’m scratching my head.

Edit: The Reserved Server is created in the game not on the roblox website.

teleportEvent.OnServerEvent:Connect(function(player, placeID, privateServerid, serverId, isRoleplaying)
	print(string.format("%s, %s, %s, %s", tostring(placeID), tostring(privateServerid), tostring(serverId), tostring(isRoleplaying)))

	if isRoleplaying then
		if typeof(placeID) == "number" then

			local teleportOpt = Instance.new("TeleportOptions")

			if typeof(privateServerid) == "string" and privateServerid ~= "" then
				teleportOpt.ReservedServerAccessCode = privateServerid
			elseif typeof(serverId) == "string" and serverId ~= "" then
				teleportOpt.ServerInstanceId = serverId
			else
				warn("No valid server access code or instance ID provided.")
				return
			end

			local success, errorMessage = pcall(function()
				game:GetService("TeleportService"):TeleportAsync(placeID, {player}, teleportOpt)
			end)

			if not success then
				warn("Failed to teleport player: " .. tostring(errorMessage))
			end
		else
			warn("Invalid placeID passed to TeleportToServer event.")
		end
	else
		warn("Player is not roleplaying, teleportation aborted.")
	end
end)

If anyone knows of a way I could do this, please let me know as I have no idea.

Cheers,

Sim_Q1

1 Like

Here is the error I get when trying to join

Here is to help this topic.
image

I decided to do it through datastore with a different way then I have done it.

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