How would you teleport a player to a different server? (In the same game)
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.