Trouble with rejoin ui button

I’m testing in the roblox game itself.

2 Likes

Is the script your using a server script or a local script, if local script then change it to server script

1 Like

image
another weird error with the new code.

1 Like

Oh, is that what we are looking for? I will look for something else I guess…

1 Like

serverscript. I said it already in one of the posts above.

1 Like

Show me the full third line please

1 Like

image

1 Like

You can’t teleport multiple players with :Teleport()

1 Like

what can I teleport multiple players with, A guy above said to try “Teleport” but it used to be “TeleportAsync”.

1 Like

Like he said use TeleportAsync (not trying to sound condescending just need to use more words for the character limit)

1 Like

thats where I got the error from after it rejoined saying Connection attempt failed.

1 Like

for _,v in pairs(game.Players:GetPlayers()) do
tp:Teleport(game.PlaceId, v)
end

1 Like

Then the script works, it’s just an issue on your part.

1 Like

oh ok, let me try it for my friend

1 Like

Why is there a bot liking every post?

1 Like

got to go now, not sure about the bot but I’ll try in the morning, thanks for all your help.

I found the following statement about a different function: TeleportPartyAsync()

Currently this function may not work reliably when teleporting Players to the same place they are currently in.

Considering it doesn’t work for that function, it might not work for the others aswell. As an alternative, you could just kick all, and hope they will rejoin… :skull:

script.Parent.MouseButton1Click:Connect(function()
	for _, player in game.Players:GetPlayers() do
		player:Kick("Please rejoin")
	end
end)

I know it is not an ideal solution : /

not the best but it’ll have to do for now :skull:

So I finally found out what you were doing wrong with the teleport async. The order of the instances called in the function were wrong and you forgot using a teleport options instance as well. Here is a correct version of the code you wrote:

script.Parent.MouseButton1Click:Connect(function()
	local id = game.GameId
	local serverid = game.JobId
        local Options = Instance.new("TeleportOptions")
        local Options.ServerInstanceId = serverid
	local tp = game:GetService("TeleportService")
	for i,v in pairs(game.Players:GetChildren()) do
		tp:TeleportAsync(id, v, Options)
	end
end)

I hope this will work!

1 Like

just run this code:
(also make sure u are running this on a local script and the parent is your button)

teleport_service=game:GetService('TeleportService')
script.Parent.MouseButton1Click:Connect(function()
	for i,v in pairs(game.Players:GetChildren()) do
		teleport_service:Teleport(PLACEIDHERE, v)
	end
end)