Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i teleport player to new server using gui button?

I wanted to make gui button that when activated will teleport player to the same game but new server

1 answer

✓ Accepted answer

You need to use TeleportService. First, place a localscript into your GUI. Inside the localscript, create a variable for the button. Then add a MouseButton1Up event and connect it to a function. Get the teleport service, and then run the function :Teleport() on the service, along with the game ID.

Your code should look something like this:


local button = script.Parent:WaitForChild("Frame"):WaitForChild("Button") -- put the path to the button here
local teleportservice = game:GetService("TeleportService") -- get teleport service
local ID = 523958034680934860 -- put your place ID here

button.MouseButton1Up:Connect(function() -- add a mousebutton1 event here and connect it to a function
	teleportservice:Teleport(ID) -- teleports the player to the place
end) 

1 comment

0

For some reason when i rejoin with this script it gives me error saying "Client initiated disconnect"

This discussion is preserved as it was. New answers, comments, and votes are closed.