Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to teleport a player to a different server?

Asked by
ItsMeKlc 235 Moderation Voter
9 years ago

How would you teleport a player to a different server? (In the same game)

1
In the words of SickAtHackers; 'This is not a request site.' GullibleChapV2 155 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

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.
Ad
Log in to vote
-2
Answered by 9 years ago

This is not a request site.

Answer this question