TeleportGui setting trouble

I’m trying to make a custom set teleport gui for players to see when they all get teleported at onces in between in-game places in the universe.

I am not sure how to set a teleport gui for a list of players correctly.

I have tried this so far:

   if #list > 0 then
   	billboard.Frame.Status.Text = "TELEPORTING"
   	billboard.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
   	local playersToTeleport = {}
   	local teleportTime = 0
   	for i=1,#list do
   		if game.Players:findFirstChild(list[i]) then
   			table.insert(playersToTeleport,game.Players:findFirstChild(list[i]))
   			TransitionEvent:FireClient(game.Players:findFirstChild(list[i]))
   		else
   			table.remove(list,i)	
   		end
   	end 
   	local code = TS:ReserveServer(placeId)
   	teleporting = true
   	TeleportService:SetTeleportGui() --what would i put in these parantheses with the list of players listed as "playersToTeleport" to set their gui?
   	TS:TeleportToPrivateServer(placeId,code,playersToTeleport)
   	repeat wait() until #list <= 0
   	billboard.Frame.Status.Text = "READY"
   	billboard.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
   	teleporting = false
   end
end

Thanks, GL_CAL

I am pretty certain you need to call TeleportService.SetTeleportGui from the client. You could try doing it within the TransitionEvent you have.

Additionally, the for loop for the transition event will not function as intended if a player leaves.

-- why reverse the loop? table.remove shifts the index
-- so therefore there could be an error raised in the end
-- because one of the last indexes would no longer
-- have a value assigned to them, and FindFirstChild would
-- throw an error
for i = #list, 1, -1 do
	local player = game.Players:FindFirstChild( list[i] )
	if not player then
		table.remove(list, i)
		continue
	end

	table.insert(playersToTeleport, player)
	TransitionEvent:FireClient(player)
end
1 Like

Thanks for the extra code that I will use now because it works and prevents the error if a player leaves during teleportation! I think I could just use the Teleport gui in the transition event because now I know it only works client sided. Thank you so much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.