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

How do i teleport players in game to another game?

Asked by 5 years ago

So i was trying to teleport players which are already in-game to another game.

0
Your own game or another game? royaltoe 5144 — 5y
0
But i have to teleport whole server, not certain players. PlanetTheo 0 — 5y

3 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

TeleportService does not work during playtesting in Roblox Studio — to test the concepts in this tutorial, you must publish the game and play it in the Roblox application.

In Roblox, teleportation is handled by TeleportService. This can be used to teleport players between places in a game or even to another game. I know quite a lot on telaporting scripts here's some I know how to do:

Getting a Target ID Most of the functions in TeleportService require the ID of the target place or game. If the destination place is in the same game as the origin place, the ID can be obtained from the Game Explorer by expanding the Places tree, right-clicking the place, and selecting Copy ID to Clipboard.

Valid Teleport Destinations TeleportService limits teleportation to places in the same game or to the starting place of another game (assuming the owner has made it public).

Data Persistence When a player is teleported between places, any custom data associated with that player is discarded. Thus, it’s very important that you consider data persistence when using TeleportService.

If players utilize any amount of secure custom data in your game, for example health, in-game currency, complex player stats, and/or a large inventory of items, data stores should be implemented to maintain data as players teleport from place to place.

If just a small amount of non-secure data should be retained, like game settings and UI theme, the TeleportService functions accept a teleportData parameter. This can be a table, string, number, or boolean which can then be retrieved in the destination place via GetLocalPlayerTeleportData().

Alternatively, if the teleport destination is another game, the ID can be copied from the URL of game’s main page on roblox.com.

Most of the functions in TeleportService require the ID of the target place or game. If the destination place is in the same game as the origin place, the ID can be obtained from the Game Explorer by expanding the Places tree, right-clicking the place, and selecting Copy ID to Clipboard.

Teleport on Part Touch: In this example, Teleport() is used to teleport players who touch the script’s parent part.

local TeleportService = game:GetService("TeleportService")

local placeID_1 = (ID HERE) local placeID_2 = (ID HERE)

local function onPartTouch(otherPart) local player = game.Players:GetPlayerFromCharacter(otherPart.Parent) if player then TeleportService:Teleport(placeID_1, player) end end script.Parent.Touched:Connect(onPartTouch)

Follow Another Player The code sample below, when placed inside a Script within ServerScriptService, will teleport a player who’s following another player to the associated place/server. ` local TeleportService = game:GetService("TeleportService") local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player) -- Is this player following anyone? local followId = player.FollowUserId -- If so, find out where they are if followId and followId ~= 0 then local success, errorMessage, placeId, jobId = pcall(function() return TeleportService:GetPlayerPlaceInstanceAsync(followId) end) if success then -- Teleport player TeleportService:TeleportToPlaceInstance(placeId, jobId, player) end else warn("Player " .. player.UserId .. " is not following another player!") end end)

Teleport To A Different Game

In order to teleport to another game, you need to take advantage of TeleportService. TeleportService has a function called Teleport, which can send you to a specific game of your choice.

The Teleport function takes in 2 arguments..

The place ID to teleport to

The Player you wish to teleport

Note: The second argument may be nil if you are using this from a LocalScript.

view source 1 local service = game:GetService("TeleportService"); 2 local place = 20279777; --Voidacity's Script Builder 3 local plr = game.Players.Goulstem; 4

5 service:Teleport(place,plr);

-Hopefully this helped if not then :(

0
Good explanation on TeleportService, but do you know how to teleport everyone in server without touch, like khols place all command? PlanetTheo 0 — 5y
0
Loop through all players BashGuy10 384 — 5y
0
If you want PlanetTheo, i can help you with teleporting all players BashGuy10 384 — 5y
Ad
Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

This thread explains it nicely

https://scriptinghelpers.org/questions/38124/how-do-i-make-a-teleporter-to-another-game

0
If you want to teleport multiple players, put the players in a table, loop through those players and teleport the individual players. royaltoe 5144 — 5y
Log in to vote
0
Answered by 5 years ago
local TeleportService = game:GetService("TeleportService")
local gameID = 3869185466 -- put game id here


local function teleport()
    local players = game.Players:GetChildren()
    for _,v in pairs(players) do
        TeleportService:Teleport(gameID, v)
    end
end

hope this helps

(BTW you would change the game id to whatever you want, and you would have to call that function everytime you wanna teleport them. You can call it by saying..)

teleport()

Answer this question