Trouble with rejoin ui button

currently making admin panel and decided to add a “rejoin” button to rejoin all players. But keep getting this error message that says validation error. Who knows how to fix this?

script.Parent.MouseButton1Click:Connect(function()
	local id = game.GameId
	local serverid = game.JobId
	local tp = game:GetService("TeleportService")
	for i,v in pairs(game.Players:GetChildren()) do
		tp:TeleportToPlaceInstance(id, serverid, v)
	end
end)
2 Likes

On the docs, i found it says:
“The numerous teleport functions have been combined into a single method, TeleportAsync, which should be used instead”

With this, your script would look like:

script.Parent.MouseButton1Click:Connect(function()
	local tp = game:GetService("TeleportService")
	tp:TeleportAsync(game.PlaceId, game.Players:GetPlayers())
end)

It works with the teleport part but when it actually rejoins it comes up with this weird error message for disconnecting I have tried this a few times and this always comes up. huh?

image

Make sure to check game settings.
security → allow third party teleports
(I think that should work)

I think you need teleport from server

1 Like

I checked and third-party-teleports is enabled.

what do you mean by that? I don’t really understand.

1 Like

is it server script or localscript

No, this doesn’t effect it at all.

You cannot teleport Other players from local script You should go normal server script

image

I would recommend trying out a very simple function, the Teleport() function. It’s very easy to use. Example of using:

game.TeleportService:Teleport(placeId, player: Instance)

That’s it, Try it out!

He’s trying to teleport the player to the same server so that wouldn’t accomplish what he wants.

It will. I looked it up. It should at least.

yeah, you’ve got that correct.

It’ll be a different server, not the same one.

wait, really? Let me try that right now.

oh wait nvm I can’t since I only have 1 server up…

Hold up a minute. Is it even possible to teleport in Studio servers anyway?

You can’t teleport in Studio servers