Image on loading screen loading in slowly

I have a custom loading screen with a decent resolution image:

The problem is, it takes almost a full second to load in the image, and before it loads, the player is left with a blank screen

I have tried loading it in as a PlayerGui first (instead of replicating it from ReplicatedStorage) and then setting the 4th parameter for the TeleportService teleport function as that cloned ui so that the image is already loaded in when the teleport starts, but for some reason the function feels the need to reload the image anyway (as seen as the image above ^^^)

Is there any good way to get around this?

[edit]: After reading over that paragraph, it seems that it may be a little difficult to understand. Lemme put it this way:

This is what i did first:

tele:Teleport("4428104632", game.Players.LocalPlayer, "", game.ReplicatedStorage.LoadingScreen)

Then i tried doing this:

local LoadingScreen = game.ReplicatedStorage.LoadingScreen:Clone()
LoadingScreen.Parent = game.Players.LocalPlayer.PlayerGui
script.Parent.Parent.Enabled = false
	
tele:Teleport("4428104632", game.Players.LocalPlayer, "", LoadingScreen)
1 Like

Prioritise the download of the image via ContentProvider’s PreloadAsync. Before showing the Gui to the user, pass it through PreloadAsync. Ideally this process should be done in ReplicatedFirst as well so that it’s the first action that occurs.

2 Likes

So like this?

local LoadingScreen = Content:PreloadAsync(game.ReplicatedStorage.LoadingScreen):Clone()
LoadingScreen.Parent = game.Players.LocalPlayer.PlayerGui
script.Parent.Parent.Enabled = false

tele:Teleport("4428104632", game.Players.LocalPlayer, "", LoadingScreen)

No. PreloadAsync accepts a table of objects. More like this:

local LocalPlayer = game:GetService("Players").LocalPlayer

local LoadingScreen = game:GetService("ReplicatedStorage").LoadingScreen:Clone()
ContentProvider:PreloadAsync({LoadingScreen})
LoadingScreen.Parent = LocalPlayer.PlayerGui
script.Parent.Parent.Enabled = false

-- Same as passing the TeleportGui as the fourth argument of Teleport
tele:SetTeleportGui(LoadingScreen)

-- Last two arguments are optional due to the above
tele:Teleport(4428104632, LocalPlayer, nil, LoadingScreen)
1 Like

Though it did seem to load in faster, the player is still left with a period of blank screen time. Would the fact that i have the code ^^^ wrapped in a textbutton.Activated event change anything?

Ideally the preload should happen outside of any kind of event, but remember that all PreloadAsync does is prioritise the download of an asset and move it into the queue if it hasn’t been used once already. There are no guarantees that you can make this faster.

I know of no faster methods other than moving the PreloadAsync out of the Activated event.

1 Like

I really wonder why this cant be seamless. If the UI is already there and loaded in, why cant roblox just keep what’s already there and use that as the loading screen instead of trying to get a new one?

Potentially because a teleport means changing the entire DataModel and wiping the cache may be part of this process. Blank screens where images are expected means the image hasn’t loaded yet and it wouldn’t be a problem if the image was cached because it can pull from there.

1 Like

If i place a second localscript in ReplicatedFirst for the destination place, and have that script contain a copy of the loading screen, then have that load in the screen when the localScript runs, would that work?

If a teleport Gui is referenced, it’s teleported along with the player. This is definitely a viable solution and it slipped me: yes, you’ll probably want to preload at the target place as well.

The loading screen will be parented to nil when teleportation is complete, so you’ll want to put it back in the player’s Gui. To do that, we need to get it first. GetArrivingTeleportGui will resolve this for you (and it’s got code samples too!). If one exists, then pass it through preload and then parent it to the player’s PlayerGui.

Perhaps that’ll work. Give it a go.

Roblox studio is bugging out, just give it a sec xd

oh jeez, i dont envy roblox’s servers today (or possibly my internet)
…and studio has frozen once more…
Oh i see the problem xd. Cinema 4d is taking up 98% of my cpu

This seems to work well enough. Thank you