Is it possible to make a user rejoin using a gui?

I’m trying to make it so when they click a gui they rejoin, I had a script for it but for some reason it didn’t work. Below is the script I used. The script is inside a button. If you could send me a script like that, that would help a lot, thanks.

script.Parent.MouseButton1Click:Connect(function(player) 
game:GetService("TeleportService"):Teleport(000, player) -- place id.

end)
1 Like

Are you using a local script or script?

I’m using a script, it’s a one player server.

local player = game.Players:FindFirstChildOfClass("Player")

script.Parent.MouseButton1Click:Connect(function()
      game:GetService("TeleportService"):Teleport(000, player) -- place id.
end)

This should work.

EDIT: This will only work on one player servers.

1 Like

My bad, I’m using a local script. It’s still a one player server though. Would the one you sent still work?

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
      game:GetService("TeleportService"):Teleport(000, player) -- place id.
end)

This is how you would do it for a local script. This works in multiple player servers too!

1 Like

The player instance isn’t even needed as this is a localscript.
You just need the id.

The script mega gave me sadly didn’t work, how do I make the player rejoin?

TeleportService:Teleport(PlaceId)

1 Like