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

How to Teleporting between Places in the Same Game?

Asked by 5 years ago

I want to Teleport a Group of Players to a Certain Server in another Game i already know how to teleport but its ot guarenteed that they will all end up in the same one.

i know how to teleport already but it sends them to the wrong place.

function onTouched(hit)
   local player = game.Players:GetPlayerFromCharacter(hit.Parent)
   if player then
       game:GetService("TeleportService"):Teleport(0000000,player)  
  end
end


script.Parent.Touched:connect(onTouched)

I know i put 000000 there it does work

1 answer

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

You can use TeleportService:ReserveServer()

What this does, is it creates a sort of private server. Only people with the code can enter it. This code is created when you reserve a server.

Here's a basic script:

local TeleportService = game:GetService("TeleportService")

local function onHit(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)

    if player then
        local code = TeleportService:ReserveServer(game.PlaceId) -- Requires game to be published
        TeleportService:TeleportToPrivateServer(game.PlaceId, code, player)
    end
end)

I can understand if you do not want to teleport the players to a private server, however this is all the knowledge I could help you with.

For more information related to TeleportService visit this link: https://developer.roblox.com/en-us/api-reference/function/TeleportService/TeleportToPrivateServer

0
Where do i put the PlaceId for the other place? sturdy2004 110 — 5y
0
You put it in the places where it says "game.PlaceId" U_srname 152 — 5y
0
once the private server is create how could i teleport a diffeent player? sturdy2004 110 — 5y
0
you can save the code of the reserved server and then use it again for a different player U_srname 152 — 5y
Ad

Answer this question