This Is The Main Script:
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local ServerStorage = game.ServerStorage
local Maps = game.ServerStorage.Maps:GetChildren()
local Rep = game.ReplicatedStorage
local Status = Rep:WaitForChild("Stats")
local Gamemanager = Rep:WaitForChild("Gamemanager")
local Mapname = Rep:WaitForChild("MapName")
local Weapons = ServerStorage:WaitForChild("Weapons")
local Teams = game:WaitForChild("Teams")
local InGame = Teams["In Game"]
local InLobby = Teams["In Lobby"]
local Winners = ReplicatedStorage:WaitForChild("Winners")
local List = {}
while true do
for i,v in pairs(Teams["In Game"]:GetPlayers()) do
v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
table.insert(List,v.Name)
Winners:FireAllClients(List)
end
for i,v in pairs(game.Players:GetPlayers()) do
v.Team = InLobby
end
Gamemanager:SetAttribute("IsIntermision",true)
Gamemanager:SetAttribute("IsGameProgress",false)
Status.Value = "Intermision: "
if Gamemanager:GetAttribute("IsIntermision") == true and Gamemanager:GetAttribute("IsGameProgress") == false then
for i = 16,1,-1 do
Gamemanager:FireAllClients(i)
wait(1)
end
else
Gamemanager:SetAttribute("IsGameProgress",true)
end
Gamemanager:SetAttribute("IsIntermision",false)
Gamemanager:SetAttribute("IsGameProgress",true)
local MapSelected = Maps[math.random(1,#Maps)]
MapSelected:Clone().Parent = workspace
curent = MapSelected.Name
Mapname.Value = curent
print(curent.." Is The Map Selected")
for _,plr in pairs(game.Players:GetChildren()) do
for _, Weapons in pairs(game.ServerStorage.Weapons:GetChildren()) do
Weapons:Clone().Parent = plr.Backpack
end
if Gamemanager:GetAttribute("IsIntermision") == false and Gamemanager:GetAttribute("IsGameProgress") == true then
plr.Character.HumanoidRootPart.CFrame = workspace.WhereTo.CFrame
else
end
end
Status.Value = "Time Remaining: "
for i,v in pairs(game.Players:GetPlayers()) do
v.Team = InGame
end
if Gamemanager:GetAttribute("IsGameProgress") == true and Gamemanager:GetAttribute("IsIntermision") == false then
for i = 31,1,-1 do
Gamemanager:FireAllClients(i)
wait(1)
end
else
Gamemanager:SetAttribute("IsIntermision",true)
end
workspace[curent]:Destroy()
Mapname.Value = ""
for _, plr in pairs(game.Players:GetChildren()) do
if Gamemanager:GetAttribute("IsGameProgress") == true and Gamemanager:GetAttribute("IsIntermision") == false then
for _,WeaponBack in pairs(plr.Backpack:GetChildren()) do
WeaponBack:Destroy()
end
if plr.Character == nil or plr.Character.HumanoidRootPart == nil then
Gamemanager:SetAttribute("IsIntermision",true)
Gamemanager:SetAttribute("IsGameProgress",false)
else
plr.Character.HumanoidRootPart.CFrame = workspace.Lobby.SpawnLocation.CFrame
end
else
warn("Cannot StartGame")
Gamemanager:SetAttribute("IsGameProgress",false)
Gamemanager:SetAttribute("IsIntermision",true)
end
end
end