i need a part of this code to make it so when the player resets/dies, the timer doesnt reset. it sounds simple to me but there might be more to it that i dont get since im a modeler not a coder. can anyone help please?
local MessagingService = game:GetService("MessagingService")
local CountdownLabel = script.Parent:WaitForChild("Countdown")
local function startCountdown(duration, message)
for i = duration, 0, -1 do
CountdownLabel.Text = message .. ": " .. string.format("%02d:%02d", math.floor(i / 60), i % 60)
wait(1)
end
end
local function onToySoldiersSpawned()
startCountdown(10 * 60, "Toy Soldiers will despawn in")
end
local function onToySoldiersDespawned()
startCountdown(15 * 60, "Toy Soldiers will spawn in")
end
MessagingService:SubscribeAsync("ToySoldiersSpawned", function()
onToySoldiersSpawned()
end)
MessagingService:SubscribeAsync("ToySoldiersDespawned", function()
onToySoldiersDespawned()
end)
-- Start initial countdown
startCountdown(15 * 60, "Toy Soldiers will spawn in")
** You are now Level 1! **