I'm scripting only for learning, why make someone else pay for that?
Here's the script, should work fine if you make a model out of every one of the five maps and, name them all map1 - map5.
MAKE SURE TO PUT THE MAPS IN SERVER STORAG!
--[[ First off, make a model out of every one of your maps, then, name each map map1,map2,map3,map4, and map 5.
]]--
wait(1)
local counter = 0 -- The counter that determines whether it will be blue or red.
local players = game.Players:GetPlayers() -- Get the players
local Blue = game.Teams.Blue.TeamColor -- Find the teams
local Red = game.Teams.Red.TeamColor
for i, player in ipairs(players) do -- Split the players var into 2 groups, Red and Blue.
print(" ") -- For debugging purposes, just a new line
print(player) -- Prints out the current player name
wait(.1) -- Very important wait
if counter == 0 then -- Uses the 1-0 counter var to choose whether the player goes on blue or red
player.TeamColor = Blue -- Puts the player on the right team
print("Blue got " .. player.Name) -- Prints out which team got which player
counter = 1 -- Changes the counter var so it's set for the next team
else
player.TeamColor = Red -- Same as before
print("Red got " .. player.Name)
counter = 0
end
end
print(" ") -- Just another newline
print("Ended") -- Prints out "Ended" to the output bar
print(" ") -- ANOTHER new line
local maps = { -- The map randomizer
workspace.map1,-- Finds all the maps
workspace.map2,
workspace.map3,
workspace.map4,
workspace.map5
}
local tp = 0 -- the location of the brick that the players will get teleported to.
local map = nil -- declares a var for the map
function c() -- A function start
local rand = math.random(1,5) -- chooses a random map
map = maps[rand] -- Still working on choosing a random map
print(map.Name.. " Was chosen") -- Prints the chosen map
tp = map.TPHere.CFrame -- Changes the tp var to the CFrame of the TPHere part, a child of every map
print("Number of players: " .. #game:GetService("Players"):GetPlayers()) -- Prints the number of players in-game
for i, player in pairs(game:GetService("Players"):GetPlayers()) do -- Puts all the players in the map
if player.Character and player.Character:FindFirstChild("Torso") then
player.Character.Torso.CFrame = tp + Vector3.new(0, i * 5, 0)
print("Was "..map.Name) -- Prints what map was used
wait(.1) -- A cute little wait
end
end
end
c() --Fires the function.
|