Soft Shutdown - Slow Teleporting Process

  1. What do you want to achieve? Make teleporting players back to the main server more effienct

  2. What is the issue?
    Once all users are teleported to the temporary server, they take a long time to teleport back to the main server, eg: one user gets teleported every like 15 seconds or so

  3. What solutions have you tried so far?
    Wrapping the teleporting scripts with a coroutine.wrap(function)

	local announcementData = {
		["Announcer"] =	"System",
		["MessageContents"] = "This is a temporary server, you will be teleported back in a moment"
	}
	task.wait(10) -- Wait for module to load
	adminModule:CreateAnnouncement(announcementData)

	local waitTime = 5

	Players.PlayerAdded:connect(function(player)
		coroutine.wrap(function()
			task.wait(5)
			waitTime = waitTime / 2
			TeleportService:Teleport(game.PlaceId, player)
		end)()
	end)
	coroutine.wrap(function()
		for _,player in pairs(Players:GetPlayers()) do
			TeleportService:Teleport(game.PlaceId, player)
			wait(waitTime)
			waitTime = waitTime / 2
		end
	end)()

maybe teleport all at once? maybe dont take so long with teleporting?

1 Like

I do both of those. If you read the post, it’s the indivdual players. Like one player will get teleported, then like 20 seconds, then the next.

If you read the script, I loop through the players in game AND I teleport them as soon as they join the game.

can you elaborate what exactly is the thing you want to achieve? more efficient doesnt tell me much

1 Like

I’ve literally described the issue. I need the users to teleport back all together, not one by one, because when I have 50 player lobbies, it takes forever.

so you want all the players in the server to teleport back at the same time?

yup, but they are going hella slow one by one

why not try TeleportService:TeleportAsync(game.PlaceId, game.Players:GetPlayers())?

Doesnt game.Players:GetPlayers() return a table, or can you add tables?

yes, when you put a table argument into teleportasync it will teleport every player it can from that table

ill try now, thanks for the help

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