I am trying to make an intermission script but the intermission doesn’t start , although the function is called.
Script (Is a normal script / server script):
local status = game.ReplicatedStorage.Status
local vals = game.ReplicatedStorage.vals
InLobby = {}
InRound = {}
intermission = 5
round = 5
function InRoundd()
if intermission <= 0 then
wait(.5)
round = 5
for i , player in pairs(game.Players:GetPlayers()) do
table.clear(InLobby)
table.insert(InRound, player)
player.Character:WaitForChild("HumanoidRootPart").CFrame = workspace.Map.SpawnRunner.CFrame
local sniper = math.random(1, #game.Players:GetPlayers())
--sniper.Character:WaitForChild("HumanoidRootPart").CFrame = workspace.Map.SpawnSniper.CFrame
end
repeat
round -= 1
game.ReplicatedStorage.Status.Value = "Time Remaining: ".. round
wait(1)
until round <= 0 or vals.Winner.Value ~= ""
if round <= 0 then
for i , player in pairs(game.Players:GetPlayers()) do
table.clear(InRound)
table.insert(InLobby, player)
player.Character:WaitForChild("HumanoidRootPart").CFrame = workspace.Lobby.SpawnLobby.CFrame
end
end
intermission = 5
end
local function InIntermission()
print("started")
intermission = 5
repeat
intermission -= 1
game.ReplicatedStorage.Status.Value = "Intermission ".. intermission
wait(1)
until intermission <= 0
InRoundd()
end
repeat wait(.5) until #game.Players:GetPlayers() >= 1
InIntermission()
game.Players.PlayerAdded:Connect(function(plr)
table.insert(InLobby, plr)
end)
if vals.Winner.Value ~= "" then
if vals.Winner.Value == game.Players[vals.Winner.Value] then
game.Players[vals.Winner.Value]:WaitForChild("leaderstats").Coins.Value += 10
status.Value = "Game won by ".. game.Players[vals.Winner.Value]
InIntermission()
end
else
status.Value = "Game won by nobody"
InIntermission()
end
end
thank you for your time!