How do I Teleport All players in the server to another game?

So I’m trying to teleport all the players in a server to another game. I’ve tried using a for loop to teleport all the players and I’ve tried using TeleportPartyAsync(). Both times I got the same error:

Teleport Failed Because The Previous Teleport Is In Processing.

I’ve looked this up and nothing I found helped.

Here is my code:

local TeleportService = game:GetService("TeleportService")

local PlayerAray = game.Players:GetChildren()

TeleportService:TeleportPartyAsync(6331956095, PlayerAray)
5 Likes

Do you have third party teleports enabled in the game settings?

4 Likes

I Believe so. Let me check. Give me a sec

EDIT: I guess I didn’t. I though I’ve teleported from that place before but I guess not. Let me try it now

2 Likes

This is in a server script right?

2 Likes

No it’s local. Does it need to be server?

1 Like

According to the Dev handbook it does, says it can only be called from the server.

TeleportService:TeleportPartyAsync (roblox.com)

2 Likes

Oh. Sorry about that. This is the first time I’ve used TeleportPartyAsync.

2 Likes

Hi. So I changed it so it fired from the server but it still didn’t work. This time with no errors.
I don’t know why. Sorry.

1 Like

Try using game.Players:GetPlayers() instead of game.Players:GetChildren()

1 Like

I did try that but it still didn’t work.
Sorry for the trouble.

1 Like

I’ve seen that but that’s just teleporting all the players to another area of the same game. I’m talking about Teleport Service.

1 Like

I don’t think that’s why it’s not working because they said they got no errors

1 Like

Im testing it in a ral client.

Oh sorry that was a typo. I meant “Real”

This function can only teleport to servers in the same game

1 Like

Instead of :TeleportPartyAsync() use :Teleport instead. Your solution of for looping would have been good if you had used this method instead of TeleportPartyAsync. It’s never worked for me, at least the way I did it, but you can still accomplish a working teleport on all players using Teleport.

Example code:

local PlayersToTeleport = game.Players:GetChildren()

for i, Player in pairs(PlayersToTeleport) do
	if Player:IsA("Player") then
		TeleportService:Teleport(6331956095, Player)
	end
end

Lemme know if this worked, I didn’t code it in studio so might have missed something.

1 Like

Ive tried somthing like thus but i got that error.

This isn’t working because you have no waits or anything. The script runs right when the server starts so there are no players in the game when it runs. Maybe add a PlayerAdded function or a wait for testing. Also, your first solution of TeleportPartyAsync() is more clean and efficient.

1 Like

I have it timed with other code but I’m currently working with just that segment

Is your script disabled? I’ve done this type of mistake before. If you’re getting no errors, and the script seems like it should work, make sure you don’t have “Disabled” on the properties menu of the script, checked.

If it’s checked, it won’t run.
image

Also you can put print() statements in your code to see where the code is going at fault. Sometimes an error won’t occur but something might not being getting registered. If you have an if statement in your code and that if statement isn’t being met, and the TeleportService code is in that if statement, it won’t error, and nothing will happen cuz the if statement wasn’t met with the true value. I’d check over your code :ok_hand:

2 Likes