Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my SetTeleportGui not working when teleporting between games?

Asked by
sssynk 58
3 years ago
Edited 3 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):

local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")


game.ReplicatedStorage.Events.TeleportPlayer.OnServerEvent:Connect(function(player, code)

    game.ReplicatedStorage.Events.PrepareTeleport:FireClient(player)

    wait(2)

    local players = Players:GetPlayers()

    TS:TeleportToPrivateServer(5132212625, code, players)

end)

Client Code (Game we are getting teleported from):

local TS = game:GetService("TeleportService")



game.ReplicatedStorage.Events.PrepareTeleport.OnClientEvent:Connect(function()

    local clone = game.ReplicatedStorage.LoadingGUI
    clone.Parent = script.Parent
    local loadingScreen = game.ReplicatedStorage:WaitForChild("LoadingGUI")
    TS:SetTeleportGui(loadingScreen)    


end)

Client Code (Game we are getting teleported to) (Placed in ReplicatedStorage):

script.Parent:RemoveDefaultLoadingScreen()
local gui = game:GetService("TeleportService"):GetArrivingTeleportGui()
gui.Parent = game.Players.LocalPlayer.PlayerGui

These scripts give the result given in the video above. Any help is appreciated. Thanks!

ItzHiimnew

0
The link should be working now. sssynk 58 — 3y
1
Ill test this out. Thanks! sssynk 58 — 3y

1 answer

Log in to vote
1
Answered by
Roger111 347 Moderation Voter
3 years ago
Edited 3 years ago

Here's a thought: 1) The server is only waiting 2 seconds for the client to set up the gui for teleport. Not that this isn't ample time, just for the sake of trying to fix your issue at any cost, maybe send an OK back to the server after the client has prepared the gui instead of waiting 2 seconds. 2) Do you have to clone the gui before setting it? What if you just set the gui to the one in RS.

0
I just figured it out, it was what you commented on earlier. I didn't wait for the TeleportGUI to be set. It works now, and if you post that as an answer, I will accept :) thanks! sssynk 58 — 3y
0
No problem! Roger111 347 — 3y
Ad

Answer this question