How to make the round end when all players are no longer alive/they beat it?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make the round end when everyone is dead or they finished the game
  2. What is the issue? Include screenshots / videos if possible!
    I have no idea how to script it
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried searching up but I could not find much
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Here is my script if needed

local voting = require(script.Voting)
local statusValue = game.ReplicatedStorage.Values.Status
local playerService = game:GetService("Players")
local playingTeam = game.Teams.Playing

while true do
	local chosenMap = voting.MapVoting(10)
	local clonedMap = chosenMap:Clone()
	
	clonedMap.Parent = workspace
	task.wait(5)
	-- Code that takes place during the round insert here
	for i, plr in pairs(playerService:GetPlayers()) do
		local character = plr.Character or plr.CharacterAdded:Wait()
		character:MoveTo(workspace:WaitForChild("TeleportPoint").Position + Vector3.new(0, 5, 0))
		plr.Team = playingTeam
	end
	for timer = 60,1,-1 do
		statusValue.Value = "Game in progress: "..timer
		task.wait(1)
	end
	clonedMap:Destroy()
	statusValue.Value = "Game ended"
	task.wait(5)
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

For your round system, you might need to put playing players on a seperate team. Then, you can add to your loop.

for timer = 60, 1, -1 do
    statusValue.Value = "Game in progress: "..timer
    task.wait(1)
    if #teamHere:GetPlayers() == 0 then break end
    if roundFinishedCondition then break end --you need to make a Boolean that will set to true if they have finished the round
end

--add some code to check the result here
2 Likes

Thanks! I tested it and it works.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.