If someone could help me that would be great! I was wondering if someone could help me modify this script to that It has red and blue team spawns and when the round starts it gives team-specific weapons from lighting or some other place and then when the round ends it takes away the weapons.
local oldMessage = ""
local minPlayers = 2
function teleportAllPlayers()
local target = CFrame.new(workspace.TeleportTarget.Position)
for i, player in ipairs(game.Players:GetChildren()) do
player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
player.Playing.Value = 1
--add an offset of 5 for each character
end
end
function message(message)
if oldMessage ~= message then
oldMessage = message
print(message)
end
end
function playersCurrentlyPlaying()
for i, player in ipairs(game.Players:GetChildren()) do
if player.Playing.Value == 1 then return true end
end
return false
end
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
player.Playing.Value = 0
end)
end)
local playing = Instance.new("IntValue", player)
playing.Value = 0
playing.Name = "Playing"
end)
while(true) do
wait(10)
if #game.Players:getPlayers() >= minPlayers then
if playersCurrentlyPlaying() then
message("Waiting for the current game to end...")
else
message("There are enough players for a new game! Teleporting...")
wait(4)
teleportAllPlayers()
end
else message("Waiting for more players...") end
end

6 comments
Thank you so much i will try it out!
Sorry to bother you again but I tried to create a function called function giveweapons and put everything underneath it, but it didn't work. I was also wondering I have a brick called teleport target where the players spawn to do you think you could help me make a teleport target for each team color?
DId you put the items in replicated storage?
Put the teleportation script at the bottom.
Oh ok I will put functions above at the top of the lobby script i made with the teleportation functions underneath. I did put the weapons in replicated storage but it keeps underlining local in blue on line 2 of the giving weapons script. Thanks so much for your help!
@fang please look below at my finished script please revise it