I have a countdown timer and I want it so when it hits 0 then it will teleport the players to 2 different parts but I dont know how I would do that
This can be more compact but this is easy to understand and edit
local players = game.Players:GetPlayers() -- get a list of all players in the game
local parts = game.Workspace:GetChildren() -- get a list of all parts in the workspace, change this to your parts folder
local usedParts = {} -- table to keep track of the parts that have already been used
-- iterate over the list of players and teleport each one to a random part
for _, player in pairs(players) do
local character = player.Character
if character then
local humanoid = character:WaitForChild("Humanoid")
local availableParts = {} -- table to store the parts that are available to choose from
for _, part in pairs(parts) do
if not usedParts[part] then -- if the part has not been used, add it to the list of available parts
table.insert(availableParts, part)
end
end
if #availableParts > 0 then -- if there are any available parts, choose one at random
local destination = availableParts[math.random(#availableParts)]
humanoid:Teleport(destination.Position)
usedParts[destination] = true -- mark the part as used
end
end
end