return function(Y)local i=script.Parent.Parent local U=i.Frame local D=U.Frame local I=D.Message local k=D.Title local q=D.Left local d=Y.gIndex local b=Y.gTable local f=Y.Title local t=Y.Message local W=Y.Scroll local V=Y.Time local T=false if not Y.Message or not Y.Title then b:Destroy()end k.Text=f I.Text=t k.TextTransparency=1 I.TextTransparency=1 k.TextStrokeTransparency=1 I.TextStrokeTransparency=1 U.BackgroundTransparency=1 local M=20 local P=10 local G=.1 local A=.5 local R=.3 local r=P/M local g=R/M local S=.8 local l=.9 local function o()b:Ready()for Y=1,M,1 do if I.TextTransparency>0 then I.TextTransparency=I.TextTransparency-S k.TextTransparency=k.TextTransparency-S end if U.BackgroundTransparency>0 then U.BackgroundTransparency=U.BackgroundTransparency-.06 D.BackgroundTransparency=U.BackgroundTransparency end service.Wait("\083\116\101\112\112\101\100")end end local function F()if not T then T=true for Y=1,M,1 do if I.TextTransparency<1 then I.TextTransparency=I.TextTransparency+S k.TextTransparency=k.TextTransparency+S end if I.TextStrokeTransparency<1 then I.TextStrokeTransparency=I.TextStrokeTransparency+l k.TextStrokeTransparency=k.TextStrokeTransparency+l end if U.BackgroundTransparency<1 then U.BackgroundTransparency=U.BackgroundTransparency+g D.BackgroundTransparency=U.BackgroundTransparency end service.Wait("\083\116\101\112\112\101\100")end;(service.UnWrap(i)):Destroy()end end b.CustomDestroy=function()F()end o()if not V then local Y,i=t:gsub(" ","")i=math.clamp(i/2,4,11)+1 q.Text="\091"..(i.."\093")for Y=i,1,-1 do if not q then break end q.Text="\091"..(Y.."\093")wait(1)end else q.Text="\091"..(V.."\093")for Y=V,1,-1 do if not q then break end q.Text="\091"..(Y.."\093")wait(1)end end q.Text="\091\067\108\111\115\105\110\103\093"wait(.3)if not T then F()end end
--// All global vars will be wiped/replaced except script

return function(data)
	local gui = script.Parent.Parent --client.UI.Prepare(script.Parent.Parent)
	local frame = gui.Frame
	local frame2 = frame.Frame
	local msg = frame2.Message
	local ttl = frame2.Title
	local Left = frame2.Left

	local gIndex = data.gIndex
	local gTable = data.gTable

	local title = data.Title
	local message = data.Message
	local scroll = data.Scroll
	local tim = data.Time

	local gone = false

	if not data.Message or not data.Title then
		gTable:Destroy()
	end

	ttl.Text = title
	msg.Text = message
	ttl.TextTransparency = 1
	msg.TextTransparency = 1
	ttl.TextStrokeTransparency = 1
	msg.TextStrokeTransparency = 1
	frame.BackgroundTransparency = 1

	local fadeSteps = 20
	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.8
	local strokeStep = 0.9

	local function fadeIn()
		gTable:Ready()
		for i = 1, fadeSteps do
			if msg.TextTransparency > 0 then
				msg.TextTransparency = msg.TextTransparency - textStep
				ttl.TextTransparency = ttl.TextTransparency - textStep
			end
			if frame.BackgroundTransparency > 0 then
				frame.BackgroundTransparency = frame.BackgroundTransparency - 0.06
				frame2.BackgroundTransparency = frame.BackgroundTransparency
			end
			service.Wait("Stepped")
		end
	end

	local function fadeOut()
		if not gone then
			gone = true
			for i = 1, fadeSteps do
				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
					frame2.BackgroundTransparency = frame.BackgroundTransparency
				end
				service.Wait("Stepped")
			end
			service.UnWrap(gui):Destroy()
		end
	end

	gTable.CustomDestroy = function()
		fadeOut()
	end

	fadeIn()

	if not tim then
		local _, time = message:gsub(" ", "")
		time = math.clamp(time / 2, 4, 11) + 1
		Left.Text = "[" .. time .. "]"
		for i = time, 1, -1 do
			if not Left then
				break
			end
			Left.Text = "[" .. i .. "]"
			wait(1)
		end
	else
		Left.Text = "[" .. tim .. "]"
		for i = tim, 1, -1 do
			if not Left then
				break
			end
			Left.Text = "[" .. i .. "]"
			wait(1)
		end
	end

	Left.Text = "[Closing]"
	wait(0.3)
	if not gone then
		fadeOut()
	end
end
