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

How to teleport a player to a different server?

2 answers

✓ Accepted answer

It depend's on what you need it for, Brick's, Gui's, etc. Here's a few example's, sorry I can't explain them any better.

Here's the basic part I'm gonna use for all the scripts:

local TeleportService = game:GetService("TeleportService") -- To refer to it.
TeleportService:Teleport(game.PlaceId,game.Players.PlayerName) -- To teleport the player.

Script to teleport a player that touched a block:

script.Parent.Touched:connect(function(Touch) -- Once it's touched.
	local plr = game.Players:GetPlayerFromCharacter(Touch.Parent) -- Find the player that touched it.
	if plr then -- Prevent some error's.
		local TeleportService = game:GetService("TeleportService") -- Same as the basic script.
		TeleportService:Teleport(game.PlaceId,plr) -- Same as basic script.
	end -- End the if function.
end) -- End the Touched function.

Script to teleport a player that click's a TextButton:

local plr = script.Parent.Parent.Parent.Parent -- To refer to the player.

script.Parent.MouseButton1Click:connect(function() -- Once it's clicked.
	local TeleportService = game:GetService("TeleportService") -- Same as basic script.
	TeleportService:Teleport(game.PlaceId,plr) -- Same as basic script.
end) -- End the Click function.

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