Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Will someone help in the script? I need to make a script where when everyone dies, the round ends.

Here is the script

local maps = game:GetService("ServerStorage").Maps:GetChildren()
local Title = game.StarterGui.MapSelector.Title
local spawns = game.Workspace.Spawns:GetChildren()
local status = game.ReplicatedStorage.Status
local start = game.Workspace.Start
ti = 0

while true do
	start.CanCollide = true
	ti = 16
	repeat
		ti = ti -1
		status.Value = "Intermission: "..ti.. "s"
		wait(1)
	until ti == 0
	
	local randomMap = maps[math.random(1, #maps)]
	randomMap:Clone().Parent = workspace
	current = randomMap.Name
	
	status.Value = "Chosen game is "..randomMap.Name
	wait(5)
	status.Value = "Loading game!"
	wait(2)
	local plrs = game.Players:GetChildren()
	
	for i = 1, #plrs do
		local randomSpawn = spawns[math.random(1, #spawns)]
		plrs[i].Character.HumanoidRootPart.CFrame = CFrame.new(randomSpawn.Position)
	end
	status.Value = "3"
	wait(1)
	status.Value = "2"
	wait(1)
	status.Value = "1"
	wait(1)
	status.Value = "GO!"
	wait(1)
	start.CanCollide = false
	ti = 61
	repeat
		ti = ti -1
		status.Value = "Time Left: ".. ti.."s"
		wait(1)
	until ti == 0
	for i = 1, #plrs do
		plrs[i].Character.HumanoidRootPart.CFrame = workspace.SpawnLocation.CFrame + Vector3.new(0, 10, 0)
	end
	
	workspace[current]:Destroy()
end

1 answer

I'm not great with these, but from my experience with this you need to get all of the total amount of players. Keep checking that amount and if that amount reaches to 0, the round ends.

1 comment

0

I understand, but I don't know how to do it

This discussion is preserved as it was. New answers, comments, and votes are closed.