As seen in many games which teleport you to another place, they have a seamless transition between servers. I’m trying to do the same thing, but the default loading screen always pops up for a second, no matter what.
I’ve looked all over and tried 3 different methods:
- premade loading screen parented to the localscript
-
SetTeleportGui
&GetArrivingTeleportGui
- create the loading screen from the localscript
All of the answers I’ve found suggest using the 2nd method, and it seems to work for them, but not for me. Using every method, the outcome stays the same.
My localscript is parented to ReplicatedFirst
. The 3rd method is the last one I tried, so here is my code:
local Loading = Instance.new("ScreenGui")
local CanvasGroup = Instance.new("CanvasGroup")
local BackgroundImage = Instance.new("ImageLabel")
local TitleLabel = Instance.new("ImageLabel")
local LoadLabel = Instance.new("TextLabel")
Loading.Name = "Loading"
Loading.Parent = game.Players.LocalPlayer.PlayerGui
Loading.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
Loading.ResetOnSpawn = false
Loading.IgnoreGuiInset = true
Loading.DisplayOrder = 999
Loading.Enabled = true
CanvasGroup.Parent = Loading
CanvasGroup.AnchorPoint = Vector2.new(0.5, 0.5)
CanvasGroup.Position = UDim2.new(0.5, 0, 0.5, 0)
CanvasGroup.Size = UDim2.new(1, 0, 1, 0)
BackgroundImage.Name = "BackgroundImage"
BackgroundImage.Parent = CanvasGroup
BackgroundImage.AnchorPoint = Vector2.new(0.5, 0.5)
BackgroundImage.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
BackgroundImage.BorderSizePixel = 0
BackgroundImage.Position = UDim2.new(5, 0, 5, 0)
BackgroundImage.Size = UDim2.new(12, 0, 12, 0)
BackgroundImage.ZIndex = 2
BackgroundImage.Image = "rbxassetid://12325899012"
BackgroundImage.ScaleType = Enum.ScaleType.Tile
BackgroundImage.ResampleMode = Enum.ResamplerMode.Pixelated
BackgroundImage.TileSize = UDim2.new(0, 80, 0, 80)
TitleLabel.Name = "TitleLabel"
TitleLabel.Parent = CanvasGroup
TitleLabel.AnchorPoint = Vector2.new(0.5, 0)
TitleLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TitleLabel.BackgroundTransparency = 1
TitleLabel.BorderSizePixel = 0
TitleLabel.Position = UDim2.new(0.5, 0, 0.2, 0)
TitleLabel.Size = UDim2.new(0.6, 0, 0.1, 0)
TitleLabel.ZIndex = 2
TitleLabel.ScaleType = Enum.ScaleType.Fit
TitleLabel.Image = "rbxassetid://12723642041"
LoadLabel.Name = "LoadLabel"
LoadLabel.Parent = CanvasGroup
LoadLabel.AnchorPoint = Vector2.new(0.5, 0.5)
LoadLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
LoadLabel.BackgroundTransparency = 1
LoadLabel.BorderSizePixel = 0
LoadLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
LoadLabel.Size = UDim2.new(0.5, 0, 0.025, 0)
LoadLabel.ZIndex = 2
LoadLabel.Font = Enum.Font.Gotham
LoadLabel.Text = "Loading..."
LoadLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
LoadLabel.TextScaled = true
LoadLabel.TextWrapped = true
---
game:GetService("ReplicatedFirst"):RemoveDefaultLoadingScreen()
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
local TweenService = game:GetService("TweenService")
TweenService:Create(BackgroundImage,
TweenInfo.new(360, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1, true, 0),
{ Position = UDim2.fromScale(-5, -5) }
):Play()
wait(5)
local clone = StarterGui:WaitForChild("UI"):Clone()
clone.Parent = game.Players.LocalPlayer.PlayerGui
wait(1)
TweenService:Create(CanvasGroup,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In),
{GroupTransparency = 1}
):Play()
wait(3)
Loading:Destroy()
script:Destroy()
Any help is appreciated!