Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is my SetTeleportGui not working when teleporting between games?

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

2 comments

0

The link should be working now.

1

Ill test this out. Thanks!

1 answer

✓ Accepted answer

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.

2 comments

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!

0

No problem!

This discussion is preserved as it was. New answers, comments, and votes are closed.