This is currently my deathmatch gamemode script (incomplete atm)
local deathmatch = {}
local timeManager = require(script.Parent.Parent.TimeManager)
local replicatedStorage = game:GetService('ReplicatedStorage')
local serverStorage = game:GetService('ServerStorage')
local teams = game:GetService('Teams')
local configuration = require(serverStorage.Configuration)
function deathmatch:Gamemode()
-- Checking for deaths, etc.
timeManager:StartTimer(configuration.DEATHMATCH_TIME, true)
end
return deathmatch
And here is the timeManager script it refers to
local timeManager = {}
local displayManager = require(script.Parent.DisplayManager)
function timeManager:StartTimer(duration, active)
for i = duration, 0, -1 do
displayManager:SetTime(i, active)
if #game.Players:GetPlayers() < 2 then
break
end
wait(1)
end
end
return timeManager
As you can see, the timeManager handles the whole count down and what not, but the problem I’m facing is within the deathmatch script. I want that script to be constantly checking for deaths within the game (or doing something) but with the function immediately setting of the timer, it doesn’t do any thing else till that timer is over. I wanna have a loop, probably a while loop, which checks for any players deaths during the game. But I can’t run anything in that script until the timer has done.
Any tips? I tried running the timeManager call inside a spawn() function, but that just made the game end immediately.