function AlertController.addAlert(k,q,P)local L=baseAlertElement:Clone()for k,q in pairs(k:GetChildren())do if q:IsA("\070\114\097\109\101")then q.LayoutOrder=q.LayoutOrder+1 end end local b=L.Message b.Text=P if q==Constants.Alert.Fail then b.TextColor3=Color3.fromRGB(201,67,58)elseif q==Constants.Alert.Success then b.TextColor3=Color3.fromRGB(89,156,82)end L.Parent=k delay(5,function()if b and b.Parent then local k=TweenService:Create(b,tweenInfo,{TextTransparency=1})k:Play()k.Completed:Wait()L:Destroy()end end)end return AlertController
--[[
	Creates a new alert in specified frame, of specified type. This will cause all existing alerts to move down, making room for the new one.
	The alert will disappear after a set time.
]]
function AlertController.addAlert(alerts, type, message)
	local entry = baseAlertElement:Clone()

	for _, child in pairs(alerts:GetChildren()) do
		if child:IsA("Frame") then
			child.LayoutOrder = child.LayoutOrder + 1
		end
	end

	local messageElement = entry.Message
	messageElement.Text = message

	if type == Constants.Alert.Fail then
		messageElement.TextColor3 = Color3.fromRGB(201, 67, 58)
	elseif type == Constants.Alert.Success then
		messageElement.TextColor3 = Color3.fromRGB(89, 156, 82)
	end

	entry.Parent = alerts

	delay(5, function()
		if messageElement and messageElement.Parent then
			local tween = TweenService:Create(messageElement, tweenInfo, { TextTransparency = 1 })

			tween:Play()

			tween.Completed:Wait()

			entry:Destroy()
		end
	end)
end

return AlertController
