How to teleport

Hello!
I was wondering if anyone had a script where they get all the players in the game and teleport them into a new game.

Atm I got this:
local TeleportService = game:GetService(“TeleportService”)

local placeID_1 = (7057409796)

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

1 Like

This Script will Teleport All the Players Once.

local TeleportService = game:GetService(“TeleportService”)
local placeIDOne = 7057409796

for i, localPlayer in pairs(game.Players:GetChildren()) do
    TeleportService:Teleport(placeIDOne,localPlayer
end

If You want to Teleport the Player Every time A Player Joins,
Use

local TeleportService = game:GetService(“TeleportService”)
local placeIDOne = 7057409796

game.Players.PlayerAdded:Connect(function(Player)
   TeleportService:Teleport(placeIDOne,Player)
end)

Make Sure The Above Scripts Are in A Script and Not A LocalScript.
This will get All Players and Teleport them.

1 Like

I have not used teleport service so much but here you go you can use this for when player touches a part he gets moved:

local TeleportService = game:GetService(“TeleportService”)
local PlaceId = otherGameId
local Players = game:GetService("Players")
local playerTpDebounce = false -- you can use debounce for more safety

local function TeleportToOtherGame(h)
  local player = Players:GetPlayerFromCharacter(h.Parent)
  if player and playerTpDebounce == false then
  playerTpDebounce = true
  TeleportService:Teleport(PlaceId,player)
  wait(0.5)
  playerTpDebounce = false
  end
end)

script.Parent.Touched:Connect(TeleportToOtherGame)

Edit: I did not read that you wanted all the players to be moved, my bad. Heres how you can do it

Insert a ServerScript into ServerScriptService, you can use remote events to know when you want to move the players if you want though.

local TeleportService = game:GetService(“TeleportService”)
local PlaceId = otherGameId
local Players = game:GetService("Players")

for i, plr in pairs(Players:GetChildren()) do
    TeleportService:Teleport(PlaceId,plr)
end

2 Likes

Funnily enough, there’s another post with hopefully what you want:

How do I Teleport All players in the server to another game? - Help and Feedback / Scripting Support - DevForum | Roblox

2 Likes

Hey it only teleport me not the other players.

Change localPlayer to player.

local TeleportService = game:GetService(“TeleportService”)
local placeIDOne = 7057409796

for i, localPlayer in pairs(game.Players:GetChildren()) do
TeleportService:Teleport(placeIDOne,Player)
end

Is that it? Because it still only teleport me.

Change everything that says localPlayer to player in the for loop.

Is there any other way? If not its alright

That wont do anything.
No matter what you Call the Second Parameter, The Meaning Stays the Same.

Use the PlayerAdded.
I Assume You want to Teleport All Players that Join.

local TeleportService = game:GetService(“TeleportService”)
local placeIDOne = 7057409796

game.Players.PlayerAdded:Connect(function(Player)
   TeleportService:Teleport(placeIDOne,Player)
end)

The Earlier Script You Tried, Only Runs Once.
Hence the Players that Join the Game After the Script Ran, Wont Get teleported.

Use this Script. This will Teleport Each Player Whenever the Player Joins.

1 Like

Its like a thing where players join the main game. After like 30 secs they get teleported (As a group) To a new game the play it and then they get teleported back for a new round.

Can You Show The Script
where You Check when the 30 Seconds is Over?

I would do Wait(30)
Then run that script that I was seeing if anyone had.

Well The Above Script (the for i, v) should be working.
Are there More than 1 Players in Game While Testing?

and Is that Script a Script (Not LocalScript) In ServerScriptService?

Does it need to be in serverscriptservice

Where are You trying it On?

{Ignore this}

A game I am making why? If I ask

It works now after I put it in there

So your problem solved?
If So,
Mark the answer as solution :happy1: