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

Team Teleport (Teleports Entire Team), Any help?

Asked by 9 years ago

I want A team teleport that teleports the two different teams to different parts of the map. My method of it is so far looping through a table, but it hasn't worked out yet. Here is my script:

local players = {}
for _, player in pairs(game.Players:GetPlayers()) do
if player.TeamColor == BrickColor.Gray() then
table.insert(players, player)
end
end

local redTable = {}
local blueTable = {}
local redPlayers = math.floor(1/2 + #players * 4/6)
local bluePlayers = 6

for i = 1, redPlayers do
local player = table.remove(players, (#players))
table.insert(redTable, player) --insert team 2 color here
player.Character.Torso.CFrame = CFrame.new(294.677, 404.2, -83.652)
end

for i = 1, bluePlayers do
local player = table.remove(players, math.random(#players))
table.insert(blueTable, player)
player.Character.Torso.CFrame = CFrame.new(294.677, 404.2, -83.652)
end

It is probably not something you want to base team teleportation off of.

Answer this question