ID 17 (Connection Failed) - Teleport from start place to a universe and then back to the start place

Basically, the start place has realm universes. Teleporting to realm universes works as it should, but when I’m teleporting back to the start place by using the teleport from the realm, the game gives me an “ID 17 - Connection Failed” error.

StarterGui:

TeleportService = game:GetService('TeleportService')
ReplicatedStorage = game:GetService("ReplicatedStorage")
Debris = game:GetService("Debris")
TweenService = game:GetService("TweenService")
ReplicatedFirst = game:GetService("ReplicatedFirst")
UI = game.Players.LocalPlayer.PlayerGui:WaitForChild("SystemUI")
local Players = game:GetService("Players")
Teleport = false
local LoadingScreen = nil
local TeleportScreen = UI.TeleportSequence
local TeleportUI = ReplicatedStorage.Elements:FindFirstChild("LoadingUI")

local screentweenInfo = TweenInfo.new(.5, Enum.EasingStyle.Quart,Enum.EasingDirection.Out)
local logotweenInfo = TweenInfo.new(2, Enum.EasingStyle.Elastic,Enum.EasingDirection.Out)
local logotweenInfoCancel = TweenInfo.new(.5, Enum.EasingStyle.Quart,Enum.EasingDirection.Out)
local FadeInBackground = TweenService:Create(UI.TeleportSequence, screentweenInfo, {BackgroundTransparency = 0} )
local FadeOutBackground = TweenService:Create(UI.TeleportSequence, screentweenInfo, {BackgroundTransparency = 1} )
local SizeOutLogo = TweenService:Create(TeleportScreen.LogoFrame.Logo, logotweenInfo, {Size=UDim2.new(1,0,1,0)})
local SizeInLogo = TweenService:Create(TeleportScreen.LogoFrame.Logo, logotweenInfoCancel, {Size=UDim2.new(0,0,0,0)})

UI.TeleportSequence.BackgroundTransparency = 0

game.Workspace:WaitForChild("SystemEvents").UniverseTeleportation.SendToClient.OnClientEvent:Connect(function(connection)
	repeat wait() until game.Loaded
	if connection == "Universe" then --load-in from a different universe
		UI.TeleportSequence.LogoFrame.Logo.Size = UDim2.new(1,0,1,0)
		wait(5)
		UI.Parent.LoadingUI:Destroy()
		print("yasssss removed it")
		SizeInLogo:Play()
		SizeInLogo.Completed:Wait()
		FadeOutBackground:Play()
		FadeOutBackground.Completed:Wait()
	elseif connection == "Website" then--regular load-in
		UI.TeleportSequence.LogoFrame.Logo.Size = UDim2.new(0,0,0,0)
		wait(5)
		SizeOutLogo:Play()
		SizeOutLogo.Completed:Wait()
		wait(5)
		SizeInLogo:Play()
		SizeInLogo.Completed:Wait()
		FadeOutBackground:Play()
		FadeOutBackground.Completed:Wait()
	end
end)

ReplicatedStorage.RealmSystem.OnClientEvent:Connect(function(RealmID)
	if Teleport == false then
		Teleport = true
		local success,error = pcall(function() 
			FadeInBackground:Play()
			FadeInBackground.Completed:Wait()
			SizeOutLogo:Play()
			SizeOutLogo.Completed:Wait()
			game:GetService("ContentProvider"):PreloadAsync({TeleportUI})
			TeleportService:SetTeleportGui(TeleportUI)
			game:GetService('TeleportService'):TeleportToSpawnByName(RealmID, "RealmTeleport")
		end)
		if error then
			Teleport = false
			print("Error with teleporting")
			SizeInLogo:Play()
			SizeInLogo.Completed:Wait()
			FadeOutBackground:Play()
			FadeOutBackground.Completed:Wait()
		end
	end
end)

ReplicatedFirst:

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

local customLoadingScreen = TeleportService:GetArrivingTeleportGui()
if customLoadingScreen then
	PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
	customLoadingScreen.Parent = PlayerGui
	ReplicatedFirst:RemoveDefaultLoadingScreen()
	repeat wait() until game:IsLoaded()
	game.Workspace:WaitForChild("SystemEvents").UniverseTeleportation:FireServer("Universe")
else
	game.Workspace:WaitForChild("SystemEvents").UniverseTeleportation:FireServer("Website")
end

RemoteEvent in Workspace:

script.Parent.OnServerEvent:Connect(function(player,connectiontype)

print(player.Name,connectiontype)

script.Parent.SendToClient:FireClient(player,connectiontype)

end)
1 Like

Teleporting returns an error in roblox studio, you have to try the actual game itself

That is the thing; I have. That’s what it does.