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

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?

You can add a person to the table on touch.
You can remove a person from the table aswell when touch ended.
Example:

inpart = part that player is touching
playerstotp = {}
inpart.Touched:Connect(function(Player)
	table.insert(playerstotp, Player.Name)
end)
inpart.TouchedEnded:Connect(function(Player)
	table.remove(playerstotp, Player.Name)
end)

I have got this script now, and it won’t work…

local timer = game.StarterGui.timer
local inpart = workspace.inpart
local Players = game:GetService("Players")
local TeleportService = game:GetSerivce("TeleportService")
local GameId = 7195505851

playerstotp = {}
inpart.Touched:Connect(function(Player)
	table.insert(playerstotp, Player.Name)
end)
inpart.TouchedEnded:Connect(function(Player)
	table.remove(playerstotp, Player.Name)
end)

if timer == 1 then
	for i,v in pairs(playerstotp) do
		local player = game.Players[v]
		TeleportService:Teleport(GameId, player)
	end
end

any help would be nice :grinning_face_with_smiling_eyes:

What kind of an instance is “timer”? If it’s a text label then you should do
local timer = tonumber(game.StarterGui.Timer.Text)

It is an intvalue… this is being displayed on another script which does work. But this one doesn’t…

If it’s an int value then you forgot to add .Value at the end.
Proper variable: local timer = game.StarterGui.timer.Value