--Customize
local IntermissionTime = 10
local RoundTime = 30
local MinPlayers = 0
--Variables
local Players = game:GetService("Players")
local Remote = game.ReplicatedStorage:WaitForChild("AFKRemote")
local PeriastronFolder = game.ServerStorage.Periastrons
local Periastrons = PeriastronFolder:GetChildren()
--SetUp
Players.PlayerAdded:Connect(function(plr)
local InGame = Instance.new("BoolValue", plr)
InGame.Name = "InGame"
InGame.Value = false
end)
--Functions
local function TPPlayers()
for i, player in Players:GetPlayers() do
if not player.Character.HumanoidRootPart then return end
player.Character.HumanoidRootPart.Position = Vector3.new(math.random(-124.5, 124.5), 10, math.random(-124.5, 124.5))
end
end
local function GiveItems()
for i, player in Players:GetPlayers() do
local RandomItem = Periastrons[math.random(1, #Periastrons)]
local Clone = RandomItem:Clone()
Clone.Parent = player.Backpack
end
end
local function KillAll()
for i, player in Players:GetPlayers() do
player.Character.Humanoid.Health = 0
end
end
local function Countdown(duration)
for i=duration, 1, -1 do
workspace:SetAttribute("Clock", i)
task.wait(1)
end
end
local function IntermissionStart()
print("Intermission")
workspace:SetAttribute("Status", "Intermission")
KillAll()
Countdown(IntermissionTime)
end
local function RoundStart()
print("Game start")
workspace:SetAttribute("Status", "Game")
TPPlayers()
GiveItems()
Countdown(RoundTime)
end
--Loop Looper
while task.wait() do
if #Players:GetPlayers() >= MinPlayers then
IntermissionStart()
RoundStart()
else
print("waiting for players")
end
end```
#how i make round stop early if all players dead 😴
1 messages · Page 1 of 1 (latest)
Can u not just check how many people are in the game every time your loop in countdown runs
Then if its 0 u break the loop and do ur stuff
how do I break the loop?
where do I put it
In the loop you want to break
preferably after a condition, so it only breaks once certain conditions are met; i.e. players alive