Hello, I need help closing my coroutine, because it currently errors…
local function decreaseLifeTime()
while true do
task.wait(1)
if messageLabel:GetAttribute("LifeTime") > 0 then
messageLabel:SetAttribute("LifeTime", messageLabel:GetAttribute("LifeTime") - 1)
else
break
end
end
end
local lifeTimeCoroutine = coroutine.create(decreaseLifeTime)
coroutine.resume(lifeTimeCoroutine)
local attributeConnection
attributeConnection = messageLabel:GetAttributeChangedSignal("LifeTime"):Connect(function()
if messageLabel:GetAttribute("LifeTime") > 0 then return end
attributeConnection:Disconnect()
coroutine.close(lifeTimeCoroutine)
tweenService:Create(messageLabel, tweenInfo, {TextTransparency = 1}):Play()
tweenService:Create(uiStroke, tweenInfo, {Transparency = 1}):Play()
debris:AddItem(messageLabel, tweenInfo.Time)
end)