Why is my SetTeleportGui not working when teleporting between games?
Asked by
4 years ago Edited 4 years ago
Video: https://www.youtube.com/watch?v=FQ5zayujy1s&feature=youtu.be
(The "Waiting for Players" screen is separate, not the screen we selected for :SetTeleportGui)
Hello all, I am using :ReserveServer, and when I teleport the player, :SetTeleportGui is not working. These are one player servers for the title screen, by the way.
Server Code (Game we are getting teleported from):
01 | local TS = game:GetService( "TeleportService" ) |
02 | local Players = game:GetService( "Players" ) |
05 | game.ReplicatedStorage.Events.TeleportPlayer.OnServerEvent:Connect( function (player, code) |
07 | game.ReplicatedStorage.Events.PrepareTeleport:FireClient(player) |
11 | local players = Players:GetPlayers() |
13 | TS:TeleportToPrivateServer( 5132212625 , code, players) |
Client Code (Game we are getting teleported from):
01 | local TS = game:GetService( "TeleportService" ) |
05 | game.ReplicatedStorage.Events.PrepareTeleport.OnClientEvent:Connect( function () |
07 | local clone = game.ReplicatedStorage.LoadingGUI |
08 | clone.Parent = script.Parent |
09 | local loadingScreen = game.ReplicatedStorage:WaitForChild( "LoadingGUI" ) |
10 | TS:SetTeleportGui(loadingScreen) |
Client Code (Game we are getting teleported to) (Placed in ReplicatedStorage):
1 | script.Parent:RemoveDefaultLoadingScreen() |
2 | local gui = game:GetService( "TeleportService" ):GetArrivingTeleportGui() |
3 | gui.Parent = game.Players.LocalPlayer.PlayerGui |
These scripts give the result given in the video above. Any help is appreciated. Thanks!
ItzHiimnew