I made a round system I will provide all the scripts at the end but I made a round system and I want it to end the round if all players are dead because I dont want them to wait until the round is over if they are all dead I tried and tried but none work I also made a intermission which is in the round system script. I hope someone can help.
Round system and intermission script:
( I have a remote event name “TimeEvent” in ReplicatedStorage)
local lobbyLocation = game.Workspace.Lobby.Position + Vector3.new(0,3,0)
local gameLocation = game.Workspace.Main.Position + Vector3.new(0,3,0)
local ReplicatedStorage = game:GetService(‘ReplicatedStorage’)
local timeEvent = ReplicatedStorage:WaitForChild(‘TimeEvent’)
local function playGame()
local timeAmount = 160
local timerText = 'Remaining Time: ’
local player = game.Players.LocalPlayer
while timeAmount > 0 do
timeEvent:FireAllClients(timeAmount, timerText) wait(1) timeAmount -= 1
end
end
local function playIntermission()
local intermission = 30
local timerText = 'Intermission: ’
while intermission > 0 do
timeEvent:FireAllClients(intermission, timerText) wait(1) intermission -= 1
end
end
local function resetPlayers()
for _, plr in pairs(game.Players:GetChildren()) do
plr.Character.HumanoidRootPart.CFrame = CFrame.new(lobbyLocation)
end
end
local function teleportPlayers()
for _, plr in pairs(game.Players:GetChildren()) do
plr.Character.HumanoidRootPart.CFrame = CFrame.new(gameLocation)
end
end
while true do
resetPlayers()
playIntermission()
teleportPlayers()
playGame()