local replicatedstorage = game:GetService('ReplicatedStorage') 
local status = replicatedstorage:WaitForChild('StatusValue')
local mapstorage = game.Workspace:WaitForChild('mapStorage')
while true do
	
while game.Players.NumPlayers < 2 do -- #2 means how many players you want for the game to start.
		status.Value = "2 or more players are required to begin!"
		repeat wait(2) until game.Players.NumPlayers >= 2 -- #2 means how many players you want for the game to start.
end

for i = 30,0,-1 do -- you can adjust the #90 to how long you want to intermission to last.
	status.Value = "Intermission... "..i
	wait(1)
end
_G.gameplayers = {}
for i, v in pairs(game.Players:GetPlayers()) do

if v then
	table.insert(_G.gameplayers, v.Name)
end

end



local mapsinserverstorage = game:GetService('ServerStorage'):GetChildren()  -- Make sure that your maps are in serverstorage. If you have more than just maps in serverstorage, the script might actually choose that.
local chosenmap = mapsinserverstorage[math.random(1, #mapsinserverstorage)]
chosenmap:Clone().Parent = mapstorage
wait(1)
status.Value = "Map chosen: "..chosenmap.Name
wait(3)
status.Value = "Get ready to be teleported!"
wait(5)
local spawns = chosenmap:WaitForChild('Spawns'):GetChildren()
for _, player in pairs (game.Players:GetPlayers()) do
	if player and #spawns > 0 then
		local Torso = player.Character:WaitForChild('Torso')
		local allspawns = math.random(1, #spawns)
		local randomspawn = spawns[allspawns]
		if randomspawn and Torso then
			table.remove(spawns, allspawns)
			Torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0,2,0))
			
			function fadeTo(a, b, c)
	for transparency = a, b, c do
	--go from a to b, counting by c
 
		for _, part in pairs(player.Character:GetChildren()) do
		--for each of the objects in the character,
 
			if part:IsA("BasePart") then
			--check if it's a part, and if so
 
				part.Transparency = transparency
				--set its transparency
			end
		end
		wait(0.1)
	end
end
			
			local primary = game.ReplicatedStorage.Sword
			local newprimary = primary:Clone()
			newprimary.Parent = player.Backpack

                      	local secondary = game.ReplicatedStorage.Pistol
			local newsecondary = primary:Clone()
			newsecondary.Parent = player.Backpack

	                local thirdy = game.ReplicatedStorage.MachineGun
			local newthirdy = primary:Clone()
			newthirdy.Parent = player.Backpack
			
		end
	end
end
status.Value = "Start Killing!" 
wait(4)
for i = 120,0,-1 do
	if i == 0 then
		status.Value = "Time Up!"
		wait(3)
		break
    end
	wait(1)
	if #_G.gameplayers == 1 then
		for i, v in pairs(_G.gameplayers) do
			if v ~= nil then
				status.Value = v.." is the Winner!"
				game.Players[v].leaderstats.Cash.Value = game.Players[v].leaderstats.Cash.Value + 100 -- The #15 will be how much credit or cash is awarded to the player if there was only one player teleported.
				break
			end
		
		end
        break
	else
	    status.Value = i.."..Seconds Remaining!"
	end
end
	
mapstorage:ClearAllChildren()
wait(1)
for i, player in ipairs(game.Players:GetPlayers()) do
	if player.Character then
		local hum = player.Character:FindFirstChild('Humanoid')
		if hum then
			hum.Health = 0
		end	
end
end
end

3 comments

0

What is the problem and whats the output?

0

Need more context to help

0

Please tell us what is the problem, we dont know what we are looking at.