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

how do i make a game teleporter?

im trying to make a teleporter from game to game, but all im getting is worthless stuff from 2017, can someone help me?

3 answers

Here's an example I made, when a player touches the part (function onTouched) then it teleports the player to another game, to teleport the player to that game you need to tell the script the gameID because that's the way it find game you don't just type their names, every game's ID is in the URL of it, so here buddy take this example script but change the ID to your ID and if you want the change the function for example if you want it to work when you press a GUI button just change the function from onTouched to onClick with a script in the GUI button, hope it helps.

local TeleportService = game:GetService("TeleportService")
local gameID = 1539354816
 
function onTouched(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
        TeleportService:Teleport(gameID, player)
    end
end
 
script.Parent.Touched:connect(onTouched)

2 comments

0

ok, but how do i set it to the closest player?

0

what im trying to do is build a lobby that sends you to the tycoon you choose, but i want a separate game for each set of tycoons, just to keep the lag down as there will be 8 people allowed on a server

You can use the Teleport method of TeleportService to teleport a player to a different place. It takes 4 arguments: the place id (int64), the player (instance), teleport data (any type), and a custom loading screen (instance).

Wiki: https://developer.roblox.com/en-us/api-reference/function/TeleportService/Teleport

Example:

local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")

local placeId = 1234

Players.PlayerAdded:Player(Connect(function(player)
	TeleportService:Teleport(player, placeId)
end)

what im trying to do is build a lobby that sends you to the tycoon you choose, but i want a separate game for each set of tycoons, just to keep the lag down as there will be 8 people allowed on a server so i need a teleporter that allows people people to touch it, and send the person why touched it to the tycoon

1 comment

0

Dude the script I sent you sends the guy that touched that part to the game

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