Hello does anyone know how to make a custom loading screen when teleporting into another game?
I have tried game.ReplicatedFirst:RemoveDefaultLoadingScreen() but then the default screen would still be there for about a second and make it look “unprofessional”. I wonder how games like Entry Point and Egg Hunt 2018 managed to do it.
Make sure your script is in replicatedFirst. Otherwise, local scripts in starterGui or something other than replicatedFirst will load in after. Replicated First scripts are replicated first.
Put it in replicated first. (I hope you meant that and not replicated storage, just checking) Replicated first scripts replicate first, which seems to be your problem.
Are you the only player in your game? Finding a server can take a few seconds, so that might be the reason. See if the message says Waiting for Server or Joining Server.
In the Egg Hunt 2018 we placed the ScreenGui which contained our loading screen in ReplicatedFirst. Alongside the GUI we included a LocalScript which handled the logic for our loading screen, this looked something like the following.
local teleportService = game:GetService("TeleportService")
local replicatedFirst = game:GetService("ReplicatedFirst")
local playerService = game:GetService("Players")
local defaultLoadingGui = replicatedFirst:WaitForChild("LoadingGui")
local loadingGui = teleportService:GetArrivingTeleportGui()
if not loadingGui then
loadingGui = defaultLoadingGui
end
local player = playerService.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
loadingGui.Parent = playerGui
teleportService:SetTeleportGui(loadingGui)
replicatedFirst:RemoveDefaultLoadingScreen()
If the player teleported into a place, we kept their existing loading screen instead of replacing it with the default one. This may or may not suit your purposes, but it’s easy enough to change.
In this situation, you would want to input (in either a Script or LocalScript)
local ScreenGui = --Gui's Path
ScreenGui.Parent = Player.PlayerGui
game:GetService("TeleportService"):SetTeleportGui( Instance ScreenGui )
game:GetService("TeleportService"):Teleport( Instance Player , Game Id )