How to make a selected group of players teleport to a different game

Hello developers,
I am trying to make an elimination type game, but I can’t figure out how to make it so that when the timer runs out, the group of players that are standing in the tunnel, get teleported to a place, AKA the round. Here is the video…
robloxapp-20210802-1622521.wmv (2.1 MB)
This is the video of the timer.
Here is the local script that if fully working.
(I would prefer to use the way this script runs other than region 3)

local timer = game.StarterGui.timer
local inpart = workspace.inpart
local plr = game.Players.LocalPlayer
local text = plr.PlayerGui:WaitForChild("ScreenGui").intext
local plrs = game.Players
local text1 = text.intext1
text.Visible = false

local Players = game:GetService("Players")

local function PopupReady(hit)
	local player = Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		text.Visible = true
	end
end

local function PopupGone(hit)
	local player = Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		text.Visible = false
	end
end

inpart.Touched:Connect(PopupReady)

inpart.TouchEnded:Connect(PopupGone)

This is a local script, so it only operates to the local player’s actions. I want it Global players, when they step in they are added to some kind of teleport list. when the timer hits 1, the players on the teleport list are teleported. Also, when they step out, they are removed from the teleport list…

Thanks! :grinning_face_with_smiling_eyes:

could I also have information on where the script is placed, and other things like that. (Extra info)

Use tables to collect the players in the tunnel or is still alive or put every players in the table then remove them as they die, after the round is over you can then just loop through that table and send them to a new place

I am no programmer… Can you just walk me through that…
How do I put each player in a table?

Do Players die in your game?, if they do so then u can just do this in server script

local AlivePlayers = {} -- we make our table variable
game.Players.PlayerAdded:Connect(function(Player) -- we get players that joined
AlivePlayers[Player] = true -- we put the newly joined players inside the table
Player.CharacterAdded:Connect(function(Char) -- we get their character

Char.Humanoid.Died:Connect(function()
--- remove them in the table as they die
AlivePlayers[Player] = nil
end)

end)
end)

---once the round ends we can just do this
for Player,Value in pairs(AlivePlayers) do -- this loops through the "AlivePlayers" table so we can get their Player Instance.
game:GetService("TeleportService").Teleport(gameId, Player)
end

Ok, so this is it… No one dies, unless they reset character. This is the game lobby, and they teleport into the round. I know about tables now, thanks! when the timer runs out then they teleport who’s in there. Where you say:

we don’t want a player to teleport, in this case we want AlivePlayers table to teleport.
In my lobby, it would kinda make it a problem, is there a way to turn off reset char. I know there is cause I play games that do that, but how?

Thanks but also I had another question, not about the reset button. Thanks!

What was the other question?, i didn’t quite get it

I know that I am making this more confusing than it needs to be.

What I have got

At the moment, there is a game lobby… There is a tunnel, that people can walk in. When you walk inside, a text label shows, “You’re in!”, it reads. There is a billboard gui, displaying a timer. The timer is an Intvalue, that is accessed by a server script.

What I haven’t got, but I want

I haven’t got it so that when the timer reaches 1, all the players who are standing in the tunnel, get teleported to the place of the main game… Is it possible to do all tabled players at once, or it a one at a time thing?

Another question,
you said Teleport(gameId, Player), did you mean Teleport(gameId, AlivePlayers)?

I know that I am no scripter…

Another question,
you said Teleport(gameId, Player), did you mean Teleport(gameId, AlivePlayers)?
for i,v in pairs(AlivePlayers) --- loops through the "AlivePlayers" table

i = Key -- which is our Player
v = Value -- the "True"

now i just renamed those to for Player, Values in pairs

and it seems like that you want the players to reach a specific place for them to get teleported. I can recommend you this

Thanks, but can you explain to me how I’d add a player to a table, and remove them when they step out. Could I copy my script that I already made, and change it. I am confused…

you can use that zone module it handles pretty much everything i guess

Would it work with what I was already doing?

Yep, i had a similar project that i did, where i made a Queue room that teleports players, and once they step into a platform then that platform will start counting down, everyone who’s inside the zone will be teleported. You can then combine that zone module with tables it has something like Zone.Entered:Connect(function() and Zone.Leaving:Connect(function() something like that if they enter the zone then add them into the table but if they leave then remove them

I am currently working on a script for it… I will show you it when done. (Not using the zone thing)

Here it is! (The timer is counting down in another script)

local timer = game.StarterGui.timer

local AlivePlayers = {}

local inpart = workspace.inpart

local Players = game:GetService("Players")

local function PlayerAdded(Player)

local player = Players:GetPlayerFromCharacter(Player.Parent)

AlivePlayers[Player] = true

end

local function PlayerRemoved(Player)

local player = Players:GetPlayerFromCharacter(Player.Parent)

AlivePlayers[Player] = nil

end

if timer == 1 then

for Player,Value in pairs(AlivePlayers) do

game:GetService("TeleportService").Teleport(7195505851, Player)

end

end

inpart.Touched:Connect(PlayerAdded)

inpart.TouchEnded:Connect(PlayerRemoved)

are you putting the server scripts individually to players? if so that’s not gonna work out, instead only have 1 script for all the players. And don’t rely on touched because it’s not accurate i had problems with that when i made mine so i resulted in using zone module.

You will need to get a table of players that are in the circle (can be their name or userid)
Then, you will need to do a for loop which will go through every player in the table and teleport them one by one. Example:

local TeleportService = game:GetSerivce("TeleportService")
local gameid = 487316
local table1 = {"Shedletsky","DevHelpAccount"}
for i,v in pairs(table1) do
	local player = game.Players[v]
	TeleportService:Teleport(gameid, player)
end

But you’re pre setting it to the players. I want it so that on the touch, they are added to the table. And touch ended, they are removed. Any chance you could help me with that?