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)
4 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)
1 Like

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

2 Likes

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

1 Like

I think you need teleport from server

2 Likes

I checked and third-party-teleports is enabled.

1 Like

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

2 Likes

is it server script or localscript

1 Like

No, this doesn’t effect it at all.

1 Like

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

1 Like

image

1 Like

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!

1 Like

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

1 Like

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

1 Like

yeah, you’ve got that correct.

1 Like

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

1 Like

wait, really? Let me try that right now.

1 Like

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

1 Like

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

1 Like

You can’t teleport in Studio servers

1 Like