return function(G)local v=client.UI.Prepare(script.Parent.Parent)local d=service.PlayerGui local l=v.Frame local C=v.Frame.Message local N=v.Frame.Title local O=G.gIndex local f=G.gTable local B=G.Title local T=G.Message local S=G.Scroll local g=G.Time if not G.Message or not G.Title then v:Destroy()end N.Text=B C.Text=T N.TextTransparency=1 C.TextTransparency=1 N.TextStrokeTransparency=1 C.TextStrokeTransparency=1 l.BackgroundTransparency=1 local U={Type="\070\117\108\108 \083\099\114\101\101\110 \077\101\115\115\097\103\101";Title=B,Message=T;Icon="\114\098\120\097\115\115\101\116\105\100\058\047\047\055\053\048\049\049\055\053\055\048\056";Time=os.date("\037\088");Function=nil}table.insert(client.Variables.CommunicationsHistory,U)service.Events.CommsPanel:Fire(U)local E=service.New("\066\108\117\114\069\102\102\101\099\116")E.Enabled=false E.Size=0 E.Parent=workspace.CurrentCamera local K=10 local H=10 local h=.1 local q=.5 local A=.3 local W=H/K local o=A/K local Q=.1 local V=.1 local k=false local function t()if not k then E.Enabled=true f:Ready()for G=1,K,1 do if E.Size<H then E.Size=E.Size+W end if C.TextTransparency>h then C.TextTransparency=C.TextTransparency-Q N.TextTransparency=N.TextTransparency-Q end if C.TextStrokeTransparency>q then C.TextStrokeTransparency=C.TextStrokeTransparency-V N.TextStrokeTransparency=N.TextStrokeTransparency-V end if l.BackgroundTransparency>A then l.BackgroundTransparency=l.BackgroundTransparency-o end wait(.016666666666667)end end end local function c()if not k then for G=1,K,1 do if E.Size>0 then E.Size=E.Size-W end if C.TextTransparency<1 then C.TextTransparency=C.TextTransparency+Q N.TextTransparency=N.TextTransparency+Q end if C.TextStrokeTransparency<1 then C.TextStrokeTransparency=C.TextStrokeTransparency+V N.TextStrokeTransparency=N.TextStrokeTransparency+V end if l.BackgroundTransparency<1 then l.BackgroundTransparency=l.BackgroundTransparency+o end wait(.016666666666667)end E.Enabled=false E:Destroy();(service.UnWrap(v)):Destroy()k=true end end f.CustomDestroy=function()if not k then k=true pcall(c)end pcall(function()(service.UnWrap(v)):Destroy()end)pcall(function()E:Destroy()end)end t()wait(g or 5)if not k then c()end end


return function(data)
	local gui = client.UI.Prepare(script.Parent.Parent) -- Change it to a TextLabel to avoid chat clearing
	local playergui = service.PlayerGui
	local frame = gui.Frame
	local msg = gui.Frame.Message
	local ttl = gui.Frame.Title
	
	local gIndex = data.gIndex
	local gTable = data.gTable
	
	local title = data.Title
	local message = data.Message
	local scroll = data.Scroll
	local tim = data.Time
	
	if not data.Message or not data.Title then gui:Destroy() end
	
	ttl.Text = title
	msg.Text = message
	ttl.TextTransparency = 1
	msg.TextTransparency = 1
	ttl.TextStrokeTransparency = 1
	msg.TextStrokeTransparency = 1
	frame.BackgroundTransparency = 1
	
	local log  = {
		Type = "Full Screen Message";
		Title = title;
		Message = message;
		Icon = "rbxassetid://7501175708";
		Time = os.date("%X");
		Function = nil;
	}

	table.insert(client.Variables.CommunicationsHistory, log) 
	service.Events.CommsPanel:Fire(log)
	
	
	local blur = service.New("BlurEffect")
	blur.Enabled = false
	blur.Size = 0
	blur.Parent = workspace.CurrentCamera
	
	local fadeSteps = 10
	local blurSize = 10
	local textFade = 0.1
	local strokeFade = 0.5
	local frameFade = 0.3
	
	local blurStep = blurSize/fadeSteps
	local frameStep = frameFade/fadeSteps
	local textStep = 0.1
	local strokeStep = 0.1
	local gone = false
	
	local function fadeIn()
		if not gone then
			blur.Enabled = true
			gTable:Ready()
			--gui.Parent = service.PlayerGui
			for i = 1,fadeSteps do
				if blur.Size<blurSize then
					blur.Size = blur.Size+blurStep
				end
				if msg.TextTransparency>textFade then
					msg.TextTransparency = msg.TextTransparency-textStep
					ttl.TextTransparency = ttl.TextTransparency-textStep
				end
				if msg.TextStrokeTransparency>strokeFade then
					msg.TextStrokeTransparency = msg.TextStrokeTransparency-strokeStep
					ttl.TextStrokeTransparency = ttl.TextStrokeTransparency-strokeStep
				end
				if frame.BackgroundTransparency>frameFade then
					frame.BackgroundTransparency = frame.BackgroundTransparency-frameStep
				end
				wait(1/60)
			end
		end
	end
	
	local function fadeOut()
		if not gone then
			for i = 1,fadeSteps do
				if blur.Size>0 then
					blur.Size = blur.Size-blurStep
				end
				if msg.TextTransparency<1 then
					msg.TextTransparency = msg.TextTransparency+textStep
					ttl.TextTransparency = ttl.TextTransparency+textStep
				end
				if msg.TextStrokeTransparency<1 then
					msg.TextStrokeTransparency = msg.TextStrokeTransparency+strokeStep
					ttl.TextStrokeTransparency = ttl.TextStrokeTransparency+strokeStep
				end
				if frame.BackgroundTransparency<1 then
					frame.BackgroundTransparency = frame.BackgroundTransparency+frameStep
				end
				wait(1/60)
			end
			blur.Enabled = false
			blur:Destroy()
			service.UnWrap(gui):Destroy()
			gone = true
		end
	end
	
	gTable.CustomDestroy = function()
		if not gone then
			gone = true
			pcall(fadeOut)
		end
		
		pcall(function() service.UnWrap(gui):Destroy() end)
		pcall(function() blur:Destroy() end)
	end
	
	
	--[[if not scroll then
		msg.Text = message
	else
		Routine(function()
			wait(0.5)
			for i = 1, #message do 
				msg.Text = msg.Text .. message:sub(i,i) 
				wait(0.05) 
			end 
		end)
	end--]] -- For now?
	
	fadeIn()
	wait(tim or 5)
	if not gone then
		fadeOut()
	end
	
	--[[
	
	frame.Position = UDim2.new(0.5,-175,-1.5,0)
	
	gui.Parent = playergui
	
	frame:TweenPosition(UDim2.new(0.5,-175,0.25,0),nil,nil,0.5)
	
	if not scroll then
		msg.Text = message
		wait(tim or 10)
	else
		wait(0.5)
		for i = 1, #message do 
			msg.Text = msg.Text .. message:sub(i,i) 
			wait(0.05) 
		end 
		wait(tim or 5) 
	end
	
	if frame then
		frame:TweenPosition(UDim2.new(0.5,-175,-1.5,0),nil,nil,0.5)
		wait(1)
		gui:Destroy()
	end
	--]]
end
