I never made a game like that so I cant answer about detecting if a boat is destroyed but for the intermission just have a loop for every 15 seconds then it checks the players
ex.
while true do
if #players:GetPlayers() >= 2 then
for i,plr in pairs(players:GetPlayers()) do
if #teams["red"] >= teams["blue"] then
-- add player to the red team then teleport to red spawn
else
--add player to blue team then teleport to blue spawn
end
end
end
end
for the boats being destroyed since I dont know much all I can say is you can do what doomspire did and just detect if all the spawns for the boat has been destroyed and if so then they lose.
To detect if the spawns are gone just have a folder for each team with there spawns and add a ChildRemoved connection to each one which checks if there is no more spawns and if so,
the enemy wins which you just fire a remote event to all clients that then makes there guis visible
– intermission
for an intermission I made I had a time limit so once the round has begun it doesnt break the intermission loop but instead creates another in it that breaks once the enemies are killed or the time limit is up
since I doubt that game will have a time limit you just need to check if the enemies have left.
after the round has ended you can just break the loop and the other loop out of it will continue.
It’s a bit messy but heres the code from an intermission I made a while ago to give you an idea.
local GameTime = 100
while true do
songremote:FireAllClients("intermission resume")
--Intermission
local Countdown = 10
repeat wait(1)
Countdown = Countdown - 1
Status.Value = 'Intermission : '..Countdown
until Countdown <= 0
local players = game.Players:GetChildren()
if #players < 1 then
Status.Value = 'Not enough players...'
task.wait(1.5)
else
--Choose the map.a
Status.Value = 'Choosing Map.'
local ChosenMap = Maps[math.random(1, #Maps)]:Clone()
local Spawns = ChosenMap:FindFirstChild('Spawns'):GetChildren()
local scpSpawns = ChosenMap:FindFirstChild('scpSpawns'):GetChildren()
local chosenBeast = players[math.random(1, #players)]
Escaped.Value = 0
for i,v in pairs(game.Players:GetPlayers()) do
if v.Character then
if v.Character:FindFirstChild("Escaped") then
game.Debris:AddItem(v.Character.Escaped,0)
end
end
end
wait(3) -- little pause, make this as long as you want
ChosenMap.Parent = workspace:WaitForChild("CurrentMap")
Status.Value = 'Map chosen, teleporting players.'
wait(2) -- little pause, make this as long as you want
songremote:FireAllClients("intermission stop")
songremote:FireAllClients("gameamb resume")
totalPlayers.Value = #players
--teleport the players
for _, Player in pairs(Players:GetChildren())do
if Player.Character and Player.Character:FindFirstChild('Humanoid') then
if Player ~= chosenBeast then
local RandomSpawn = Spawns[math.random(1, #Spawns)]
Player.Character.HumanoidRootPart.CFrame = RandomSpawn.CFrame
local survive = Instance.new("BoolValue")
survive.Name = "Class-D"
survive.Parent = Player.Character
else
local beast = Instance.new("BoolValue")
beast.Name = "SCP-106"
local oldModel = Player.Character
local newModel = scpModel:Clone()
local oldCFrame = oldModel:GetPrimaryPartCFrame()
Player.Character = newModel
newModel.Parent = workspace -- [1] this follows current character loading behavior
newModel:SetPrimaryPartCFrame(oldCFrame)
oldModel:Destroy()
beast.Parent = Player.Character
Player.Character.HumanoidRootPart.CFrame = game.Workspace:WaitForChild("BeastLobby"):FindFirstChild("BeastLobbySpawn").CFrame
end
end
end
Countdown = 2 -- Starting Round In, make this as long as you want
repeat wait(1)
Countdown = Countdown - 1
Status.Value = 'Starting Round in : '..Countdown
until Countdown <= 0
chosenBeast.Character.HumanoidRootPart.CFrame = scpSpawns[math.random(1, #scpSpawns)].CFrame
Countdown = GameTime -- Game Time, ten seconds so the video isn't long, make this as long as you want.
repeat wait(1)
Countdown = Countdown - 1
Status.Value = 'Ingame : '..Countdown
if game.Players:GetPlayerFromCharacter(chosenBeast.Character) == nil then
Status.Value = 'Beast left, restarting...'
for i,v in pairs(game.Players:GetPlayers()) do
if v.Character and v.Character:FindFirstChild("Class-D") then
local escaped = Instance.new("BoolValue")
escaped.Name = "Escaped"
escaped.Parent = v.Character
end
end
for i,v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("leaderstats") and v.Character:FindFirstChild("Escaped") then
v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
print(v.leaderstats.Wins.Value)
end
end
task.wait(2)
Countdown = 0
end
surviving.Value = 0
for i,v in pairs(game.Players:GetPlayers()) do
if v.Character then
if v.Character:FindFirstChild("Class-D") then
surviving.Value = surviving.Value + 1
end
end
end
if surviving.Value <=0 then
local dead = totalPlayers.Value - Escaped.Value
if Escaped.Value >= dead then -- survivors win
Status.Value = "Class-D's escaped! Restarting round..."
for i,v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("leaderstats") and v.Character:FindFirstChild("Escaped") then
v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
print(v.leaderstats.Wins.Value)
end
end
task.wait(2)
Countdown = 0
else -- scp wins
Status.Value = 'SCP wins! Restarting round...'
for i,v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("leaderstats") and v.Character:FindFirstChild("SCP-106") then
v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
print(v.leaderstats.Wins.Value)
end
end
task.wait(2)
Countdown = 0
end
end
until Countdown <= 0
--Kill the players
songremote:FireAllClients("gameamb stop")
for _, Player in pairs(Players:GetChildren())do
if Player.Character and Player.Character:FindFirstChild('Humanoid') then
Player.Character.Humanoid:TakeDamage(2000)
end
end
ChosenMap:Destroy()
Status.Value = 'Round Ended, waiting for new game.'
wait(4) -- little pause, make this as long as you want.
end
end
sorry if this post is messy I just wrote what came into my mind as I only made one intermission so a lot of improvements could be made from my idea