SetTeleportGui - How to make the GUI appear both in the start and end server?

Trying to use SetTeleportGui to avoid the ROBLOX loading screen in the game.

By using the SetTeleportGui(), I managed to get rid of the ROBLOX splash screen, but when I connect to the end server that I was sent to, prior to spawning, I see the world below me instead.

I’ve looked at various posts and the wiki as well and nothing is properly documented; how do I make the SetTeleportGui seamlessly teleport through the start and end server?

Can you show me the script so I can try to fix the error?

And a screenshot of where the GUI is located and the script?

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.SystemUI
local Players = game:GetService("Players")
Teleport = false
local LoadingScreen = nil
local TeleportScreen = UI.TeleportSequence

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)})


while not game.Players.LocalPlayer do
	
end

TeleportScreen.BackgroundTransparency = 0
SizeOutLogo:Play()
SizeOutLogo.Completed:Wait()
wait(2)
SizeInLogo:Play()
SizeInLogo.Completed:Wait()
FadeOutBackground:Play()
FadeOutBackground.Completed:Wait()

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({TeleportScreen})
			TeleportScreen.Visible = true
			TeleportService:SetTeleportGui(TeleportScreen)
			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
	local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
	ReplicatedFirst:RemoveDefaultLoadingScreen()
	customLoadingScreen.Parent = playerGui
	-- animate screen here
	wait(5)
	-- destroy screen
	customLoadingScreen:Destroy()
end

https://gyazo.com/a5da99a653ba5da73e987786006f1667

Does the RealmSystem event get fired?

1 Like

Yeah, the RealmSystem event fires normally.

1 Like

I’m actually not quite sure if I can fix the problem.

1 Like

At least you tried! Thanks for trying to help out.

Issue is still ongoing, any feedback is appreciated!

1 Like

No problem. Have a nice day! :slight_smile:

I think I see the issue. I noticed that when teleporting, you are changing the visibility property of a frame to Visible. However I believe the properties reset to how they were without scripts while being teleported.
I suggest you would make a new ScreenGui instead, put this one in ReplicatedStorage.

As you have a fade tween, I recommend you change your frame’s transparency to 0 and Visibility to true.
In the teleport script, quickly change the transparency to 1, and then bring the TeleportGui into the PlayerGui. Now you are safe to make the fade in effect.
Now in the place you are teleporting to, make an identical ScreenGui as your TeleportGui inside of ReplicatedFirst. Use repeat wait until game:IsLoaded() and then wait about 2 or 3 seconds. Now you can fade out and destroy your UI using another LocalScript.

For better context here are some screenshots of my workspace:
Start Place
image
Destination Place:
image

Here is a short script that should fix your issue, keep in mind I used a button for the teleport to make this easier to explain:
The script inside the button I used

script.Parent.MouseButton1Click:Connect(function()
	
	local TweenService = game:GetService("TweenService")
	local TeleportService = game:GetService("TeleportService")
	local ReplicatedStorage = game:GetService("ReplicatedStorage")
	local Players = game:GetService("Players")
	local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")

	local placeId = 8486213665
	local TeleportUI = ReplicatedStorage:FindFirstChild("TeleportGui")
	
	local screentweenInfo = TweenInfo.new(.5, Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
	local logotweenInfo = TweenInfo.new(2, Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
	local logotweenInfoCancel = TweenInfo.new(.5, Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
	local FadeInBackground = TweenService:Create(TeleportUI.Frame, screentweenInfo, {BackgroundTransparency = 0} )
	local FadeOutBackground = TweenService:Create(TeleportUI.Frame, screentweenInfo, {BackgroundTransparency = 1} )
	local SizeOutLogo = TweenService:Create(TeleportUI.Frame.Logo, logotweenInfo, {Size=UDim2.new(1,0,1,0)})
	local SizeInLogo = TweenService:Create(TeleportUI.Frame.Logo, logotweenInfoCancel, {Size=UDim2.new(0,0,0,0)})
	
	repeat wait() until Players.LocalPlayer
	
	TeleportUI.Frame.Logo.Size = UDim2.new(0,0,0,0)
	TeleportUI.Frame.BackgroundTransparency = 1
	TeleportUI.Parent = playerGui
	
	FadeInBackground:Play()
	FadeInBackground.Completed:Wait()
	SizeOutLogo:Play()
	SizeOutLogo.Completed:Wait()

	TeleportService:SetTeleportGui(TeleportUI)

	TeleportService:Teleport(placeId)
end)

The script in the TeleportGui of the destination place

local Players = game:GetService("Players")
local TeleportUI = script.Parent.Parent
TeleportUI.Parent = Players.LocalPlayer.PlayerGui

local TweenService = game:GetService("TweenService")

local screentweenInfo = TweenInfo.new(.5, Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
local logotweenInfo = TweenInfo.new(2, Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
local logotweenInfoCancel = TweenInfo.new(.5, Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
local FadeInBackground = TweenService:Create(TeleportUI.Frame, screentweenInfo, {BackgroundTransparency = 0} )
local FadeOutBackground = TweenService:Create(TeleportUI.Frame, screentweenInfo, {BackgroundTransparency = 1} )
local SizeOutLogo = TweenService:Create(TeleportUI.Frame.Logo, logotweenInfo, {Size=UDim2.new(1,0,1,0)})
local SizeInLogo = TweenService:Create(TeleportUI.Frame.Logo, logotweenInfoCancel, {Size=UDim2.new(0,0,0,0)})

TeleportUI.Frame.Logo.Size = UDim2.new(1,1,1,1)
TeleportUI.Frame.BackgroundTransparency = 0

repeat wait() until game:IsLoaded()

wait(1.5)

SizeOutLogo:Play()
SizeOutLogo.Completed:Wait()
wait(2)
FadeOutBackground:Play()
FadeOutBackground.Completed:Wait()

script.Parent.Parent:Destroy()

A video that shows that it works:

I’m not that great at explaining things, so I hope this is enough to fix your issue. If there are any other problems you may be having, be sure to reply

And something you may want to look into is disabling the CoreGui while teleporting, it will make place teleporting look insanely smooth with a TeleportGui.

6 Likes

Yeah, I totally forgot that they might reset the UI to the original state!

Thanks for the help! I appreciate it.