I got this issue where this notification won’t delete from a notification list after waiting for the tween to finish so instead of using a wait I used a tween.completed
but it still doesn’t work. The mouseButton1click also does not fire when I click on it even though the notification is still in the list.
function notification.new(text, Type, length)
local newNotification = Notification:Clone()
newNotification.Label.Text = text
newNotification.Fill.BackgroundColor3 = notification.Types[Type].Color
newNotification.Parent = NotificationList
newNotification:TweenSize(UDim2.new(1, 0,0.308, 0),Enum.EasingDirection.In, Enum.EasingStyle.Sine, .1, false)
task.spawn(function()
print("spawned")
local tween = TweenService:Create(newNotification.Fill , TweenInfo.new(length), {Size = newNotification.Fill.Size - UDim2.new(1,0,0,0)})
print("tween")
tween:Play()
print("playing")
task.wait(length)
print("done waiting")
tween.Completed:Connect(function()
print("its done")
newNotification:TweenSize(UDim2.new(1, 0, 0, 0),Enum.EasingDirection.In, Enum.EasingStyle.Sine, 0.1, false)
task.wait(0.1)
print("deleted")
if newNotification then
newNotification:Destroy()
print("destroyed")
end
end)
end)
newNotification.Button.MouseButton1Click:Connect(function()
print("pressed")
newNotification:TweenSize(UDim2.new(1, 0, 0, 0),Enum.EasingDirection.In, Enum.EasingStyle.Sine, .1, false)
task.wait(0.1)
if newNotification then
newNotification:Destroy()
end
end)
if Type == "Success" then
script.Parent.Parent.SpeedRaised:Play()
end
end