return function(D)local q=script.Parent.Parent local u=q.Frame local n=u.Frame local B=n.Message local y=n.Title local X=n.Left local Z=D.gIndex local e=D.gTable local g=D.Title local R=D.Message local m=D.Scroll local O=D.Time local l=false if not D.Message or not D.Title then e:Destroy()end y.Text=g B.Text=R y.TextTransparency=1 B.TextTransparency=1 y.TextStrokeTransparency=1 B.TextStrokeTransparency=1 u.BackgroundTransparency=1 local f=20 local T=10 local L=.1 local N=.5 local i=.3 local U=T/f local o=i/f local b=.8 local c=.9 local function G()e:Ready()for D=1,f,1 do if B.TextTransparency>0 then B.TextTransparency=B.TextTransparency-b y.TextTransparency=y.TextTransparency-b end if u.BackgroundTransparency>0 then u.BackgroundTransparency=u.BackgroundTransparency-.06 n.BackgroundTransparency=u.BackgroundTransparency end service.Wait("\083\116\101\112\112\101\100")end end local function w()if not l then l=true for D=1,f,1 do if B.TextTransparency<1 then B.TextTransparency=B.TextTransparency+b y.TextTransparency=y.TextTransparency+b end if B.TextStrokeTransparency<1 then B.TextStrokeTransparency=B.TextStrokeTransparency+c y.TextStrokeTransparency=y.TextStrokeTransparency+c end if u.BackgroundTransparency<1 then u.BackgroundTransparency=u.BackgroundTransparency+o n.BackgroundTransparency=u.BackgroundTransparency end service.Wait("\083\116\101\112\112\101\100")end;(service.UnWrap(q)):Destroy()end end e.CustomDestroy=function()w()end G()if not O then local D,q=R:gsub(" ","")q=math.clamp(q/2,4,11)+1 X.Text="\091"..(q.."\093")for D=q,1,-1 do if not X then break end X.Text="\091"..(D.."\093")wait(1)end else X.Text="\091"..(O.."\093")for D=O,1,-1 do if not X then break end X.Text="\091"..(D.."\093")wait(1)end end X.Text="\091\067\108\111\115\105\110\103\093"wait(.3)if not l then w()end end


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
