What do you want to achieve?
I want to the round to end when there is one person left or all of the enemies are dead (PVP)
What is the issue?
I have no idea how to implement this
What solutions have you tried so far?
I’ve tried keeping all the players in a table and taking them out when they die(which is currently in the code now), and I couldn’t find anything the Dev Forum
The excerpted code from the Round system
local function roundTimer()
local players = {}
while wait() do
game.SoundService.GameIntro.TimePosition = 39
game.SoundService.GameIntro.Playing = true
for i =intermissonLength,0,-1 do
InRound.Value = false
wait(1)
status.Value = i
end
status.Value = 0
table.clear(players)
wait()
if #game.Players:GetChildren() == 1 then
game.SoundService.GameIntro.Playing = false
status.Value = -1
wait(3)
spawn(roundTimer)
break
end
RUI:FireAllClients()
for _,player in pairs(game.Players:GetChildren()) do wait()
table.insert(players,player.Name)
local char = player.Character
char:WaitForChild("Humanoid").Died:Connect(function()
local index = table.find(players,player.Name)
table.remove(players,index)
end)
end
for i = 0.15,0.05,-0.0015 do
game.SoundService.GameIntro.Volume = i
wait(0.12)
end
game.SoundService.GameIntro.Playing = false
InRound.Value = true
game.SoundService.GameIntro.TimePosition = 142
game.SoundService.GameIntro.Playing = true
game.SoundService.GameIntro.Volume = 0.3
wait(18.5)
for i = 0.3,0,0.025 do
game.SoundService.GameIntro.Volume = i
wait(0.05)
end
game.SoundService.GameIntro.Playing = false
for i = roundlength,0,-1 do
InRound.Value = true
wait(1)
status.Value = i
local vamp = script.Parent.NormalRoles.Vampire.Value
for _,player in pairs(game.Players:GetChildren()) do
local char = player.Character
char:WaitForChild("Humanoid").Died:Connect(function()
local index = table.find(players,player.Name)
table.remove(players,index)
end)
end
if i <= 170 then
local find = table.find(players,vamp.Name,1)
if table.getn(players) == 1 then
status.Value = -2
break
end
end
end
for i = 1,#game.Workspace.Characters:GetChildren() do
local charToUndo = game.Workspace.Characters:GetChildren() [i]
charToUndo.Picked.Value = false
end
wait(1)
InRound.Value = false
wait(5)
end
end