function module.Message(X,A)local U=messageContainer.Messages local r=.4 local l=A[1]local b=A[2]local q=A[3]local v=A[4]local j=A[5]local s=A[6]local Y=main.templates.Message:Clone()for A,X in pairs(Y:GetChildren())do X[getTargetProp(X)]=1 end Y.Visible=true if b=="\067\111\117\110\116\100\111\119\110"then local A={Y.Bg;Y.Title;Y.Desc}Y.Title.Text="\067\111\117\110\116\100\111\119\110"Y.Title.TextColor3=Color3.fromRGB(200,200,200)Y.Desc.TextColor3=s Y.Parent=U spawn(function()displayMessages(A,0,r)end)for A=1,j,1 do Y.Desc.Text=(j+1)-A wait(1)end displayMessages(A,1,r)else Y.Title.Text=q Y.SubTitle.Text=q Y.Desc.Text=j Y.Desc.TextColor3=s if b=="\083\101\114\118\101\114"or l==nil then Y.Pic.Visible=false Y.SubTitle.Visible=false else local A=main.textService:GetTextSize(q,Y.Title.TextSize,Y.Title.Font,Vector2.new(0,0))Y.Pic.Position=UDim2.new(.5,-(A.X/2+75))Y.Pic.Image=(main:GetModule("\099\102")):GetUserImage(l.UserId)Y.SubTitle.Text=v end Y.Parent=U local A=getMessageAppearOrder(Y)for X=1,#A,1 do displayMessages(A[X],0,r)end wait((main:GetModule("\099\102")):GetMessageTime(j))for X=1,#A,1 do local U=(#A+1)-X displayMessages(A[U],1,r)end end Y:Destroy()end function module.Hint(X,A)local U=messageContainer.Hints local r=.6 local l=A[1]local b=A[2]local q=A[3]local v={}local j=main.templates.Hint:Clone()for A,X in pairs(j:GetChildren())do X[getTargetProp(X)]=1 table.insert(v,X)end j.Desc.Text=b j.Desc.TextColor3=q j.Parent=U j.Visible=true if l=="\067\111\117\110\116\100\111\119\110"then spawn(function()displayMessages(v,0,r)end)for A=1,b,1 do j.Desc.Text=(b+1)-A wait(1)end displayMessages(v,1,r)else j.Desc.Text=b j.Desc.TextColor3=q j.Parent=U displayMessages(v,0,r)wait((main:GetModule("\099\102")):GetMessageTime(b))displayMessages(v,1,r)end j:Destroy()end function module.GlobalAnnouncement(X,A)local U=messageContainer.Messages local r=.4 local l=main.templates.GlobalAnnouncement:Clone()local b=A.DisplayFrom for A,X in pairs(l:GetChildren())do X[getTargetProp(X)]=1 end l.Visible=true l.Title.Text=A.Title l.Pic.Visible=b l.SubTitle.Visible=b local q=main.textService:GetTextSize(l.SubTitle.Text,l.SubTitle.TextSize,l.SubTitle.Font,Vector2.new(0,0))l.Pic.Position=UDim2.new(.5,-(q.X/2+30),0,60)if b then l.Pic.Image=(main:GetModule("\099\102")):GetUserImage(A.SenderId)l.SubTitle.Text="\070\114\111\109 "..A.SenderName end l.Desc.TextColor3=Color3.new(A.Color[1],A.Color[2],A.Color[3])l.Desc.Text=A.Message l.Parent=U local v=getMessageAppearOrder(l)for A=1,#v,1 do displayMessages(v[A],0,r)end wait((main:GetModule("\099\102")):GetMessageTime(A.Message)*1.5)for A=1,#v,1 do local X=(#v+1)-A displayMessages(v[X],1,r)end l:Destroy()end function module.ClearMessageContainer(A)for A,X in pairs(messageContainer:GetChildren())do for A,X in pairs(X:GetChildren())do if X:IsA("\070\114\097\109\101")then X.Visible=false end end end end return module

function module:Message(args)
	local containerFrame = messageContainer.Messages
	
	local tweenTime = 0.4
	local mSpeaker = args[1]
	local mType = args[2]
	local mTitle = args[3]
	local mSubTitle = args[4]
	local mDesc = args[5]
	local mDescColor = args[6]
	
	local message = main.templates.Message:Clone()
	for i,v in pairs(message:GetChildren()) do
		v[getTargetProp(v)] = 1
	end
	message.Visible = true
	
	if mType == "Countdown" then
		local items = {message.Bg, message.Title, message.Desc}
		message.Title.Text = "Countdown"
		message.Title.TextColor3 = Color3.fromRGB(200,200,200)
		message.Desc.TextColor3 = mDescColor
		message.Parent = containerFrame
		spawn(function() displayMessages(items, 0, tweenTime) end)
		for i = 1, mDesc do
			message.Desc.Text = mDesc+1-i
			wait(1)
		end
		displayMessages(items, 1, tweenTime)
	else
		message.Title.Text = mTitle
		message.SubTitle.Text = mTitle
		message.Desc.Text = mDesc
		message.Desc.TextColor3 = mDescColor
		if mType == "Server" or mSpeaker == nil then
			message.Pic.Visible = false
			message.SubTitle.Visible = false
		else
			local size = main.textService:GetTextSize(mTitle, message.Title.TextSize, message.Title.Font, Vector2.new(0,0))
			message.Pic.Position = UDim2.new(0.5,-((size.X/2)+75))
			message.Pic.Image = main:GetModule("cf"):GetUserImage(mSpeaker.UserId)
			message.SubTitle.Text = mSubTitle
		end
		message.Parent = containerFrame
		
		local messageAppearOrder = getMessageAppearOrder(message)
		for i = 1, #messageAppearOrder do
			displayMessages(messageAppearOrder[i], 0, tweenTime)
		end
		wait(main:GetModule("cf"):GetMessageTime(mDesc))
		for i = 1, #messageAppearOrder do
			local newI = #messageAppearOrder+1-i
			displayMessages(messageAppearOrder[newI], 1, tweenTime)
		end
		
	end
	message:Destroy()
end



function module:Hint(args)
	local containerFrame = messageContainer.Hints
	
	local tweenTime = 0.6
	local hType = args[1]
	local hDesc = args[2]
	local hDescColor = args[3]
	
	local items = {}
	local hint = main.templates.Hint:Clone()
	for i,v in pairs(hint:GetChildren()) do
		v[getTargetProp(v)] = 1
		table.insert(items, v)
	end
	hint.Desc.Text = hDesc
	hint.Desc.TextColor3 = hDescColor
	hint.Parent = containerFrame
	hint.Visible = true
	
	if hType == "Countdown" then
		spawn(function() displayMessages(items, 0, tweenTime) end)
		for i = 1, hDesc do
			hint.Desc.Text = hDesc+1-i
			wait(1)
		end
		displayMessages(items, 1, tweenTime)
	else
		hint.Desc.Text = hDesc
		hint.Desc.TextColor3 = hDescColor
		hint.Parent = containerFrame
		
		displayMessages(items, 0, tweenTime)
		wait(main:GetModule("cf"):GetMessageTime(hDesc))
		displayMessages(items, 1, tweenTime)
		
	end
	
	hint:Destroy()
	
end



function module:GlobalAnnouncement(data)
	local containerFrame = messageContainer.Messages
	local tweenTime = 0.4
	local message = main.templates.GlobalAnnouncement:Clone()
	local displayFrom = data.DisplayFrom
	
	for i,v in pairs(message:GetChildren()) do
		v[getTargetProp(v)] = 1
	end
	message.Visible = true
	message.Title.Text = data.Title
	message.Pic.Visible = displayFrom
	message.SubTitle.Visible = displayFrom
	local size = main.textService:GetTextSize(message.SubTitle.Text, message.SubTitle.TextSize, message.SubTitle.Font, Vector2.new(0,0))
	message.Pic.Position = UDim2.new(0.5, -((size.X/2)+30), 0, 60)
	if displayFrom then
		message.Pic.Image = main:GetModule("cf"):GetUserImage(data.SenderId)
		message.SubTitle.Text = "From ".. data.SenderName
	end
	message.Desc.TextColor3 = Color3.new(data.Color[1], data.Color[2], data.Color[3])
	message.Desc.Text = data.Message
	message.Parent = containerFrame
	
	local messageAppearOrder = getMessageAppearOrder(message)
	for i = 1, #messageAppearOrder do
		displayMessages(messageAppearOrder[i], 0, tweenTime)
	end
	wait(main:GetModule("cf"):GetMessageTime(data.Message)*1.5)
	for i = 1, #messageAppearOrder do
		local newI = #messageAppearOrder+1-i
		displayMessages(messageAppearOrder[newI], 1, tweenTime)
	end
		
	message:Destroy()
end



function module:ClearMessageContainer()
	for a,b in pairs(messageContainer:GetChildren()) do
		for c,d in pairs(b:GetChildren()) do
			if d:IsA("Frame") then
				d.Visible = false
			end
		end
	end
end



return module
