Teleport service and SetTeleportGui

hello

I’m trying to make a loading screen between 2 places using TeleportService and :SetTeleportGui.
but the music stops and the images disappear!!

I made an example for a better understanding

Is there any way that the images do not disappear?

1 Like

SetTeleportGui will only send a static ScreenGui while teleporting. It cannot run any scripts nor play any music: it can only display some content you created in terms of ScreenGuis. As for the images disappearing, this is most likely a fault with your implementation that you overlooked. Remember to have everything visible while teleporting and that the image has actually loaded.

1 Like

Will roblox ever support scripts in loading screens?

Doesn’t look that way. Right now, only CoreScripts are permitted to run code for loading screens. I would assume a good chunk of the reason relates to security and native support (which there is none), among other factors. I wouldn’t know though.

1 Like

my loading screen has no scripts
It only has music and an image
my gui has nothing wrong

I just want the image not to disappear.

It’s hard to discern the issue when you’ve provided a lack of resources or information to go off of. A place link doesn’t do much because what’s behind the code work is unknown. As well: you can’t rule out any issues because those very well could be what are your problems.

Mind providing a repro file regarding the issue you’re encountering?

localscript in ReplicatedFirst:

local TeleportService = game:GetService("TeleportService")
local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")

repeat wait() until game:IsLoaded()


local loadScreen = game.ReplicatedStorage.loadscreen

local music = workspace.music
music.Parent = loadScreen

loadScreen.Parent = PlayerGui
TeleportService:SetTeleportGui(loadScreen)
TeleportService:Teleport(4501797466)

game.ReplicatedStorage.loadscreen:
replicatedStor

1 Like

Your image most likely has not loaded yet in this scenario. Try forcing the image to download via the use of PreloadAsync. I’m not too sure why you’re teleporting immediately in ReplicatedFirst though.

game:GetService("ContentProvider"):PreloadAsync({loadScreen})
TeleportService:SetTeleportGui(loadScreen)
TeleportService:Teleport(4501797466)
1 Like

now:

local TeleportService = game:GetService("TeleportService")
local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")

repeat wait() until game:IsLoaded()


local loadScreen = game.ReplicatedStorage.loadscreen
game:GetService("ContentProvider"):PreloadAsync({loadScreen})

local music = workspace.music
music.Parent = loadScreen

loadScreen.Parent = PlayerGui
TeleportService:SetTeleportGui(loadScreen)
TeleportService:Teleport(4501797466)

the image keeps disappearing !!

look:
my game has 2 places and a single loading gui called: “loadscreen”
pf1

replicatedStor

“loading screen testing” uses : TeleportService:SetTeleportGui(loadScreen)
“level1” uses : local loadscreen = TeleportService:GetArrivingTeleportGui()

This is what always happens:

1 Like

Maybe try?

local TeleportService = game:GetService("TeleportService")
local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")

repeat wait() until game:IsLoaded()

local loadScreen = game.ReplicatedStorage.loadscreen
local arrivingLoadScreen = TeleportService:GetArrivingTeleportGui()
game:GetService("ContentProvider"):PreloadAsync({loadScreen, arrivingLoadScreen})

local music = workspace.music
music.Parent = loadScreen

loadScreen.Parent = PlayerGui
TeleportService:SetTeleportGui(loadScreen)
TeleportService:Teleport(4501797466)

SORRY FOR BUMPING