return function(l)local a=script.Parent.Parent local d=a.Frame local u=d.Frame local n=u.Message local K=u.Title local X=l.gIndex local U=l.gTable local E=l.Title local I=l.Message local W=l.Scroll local w=l.Time local y=false if not l.Message or not l.Title then U:Destroy()end K.Text=E n.Text=I K.TextTransparency=1 n.TextTransparency=1 K.TextStrokeTransparency=1 n.TextStrokeTransparency=1 d.BackgroundTransparency=1 local G=10 local L=10 local O=.1 local D=.5 local s=d.BackgroundTransparency local o=L/G local h=s/G local r=.1 local m=.1 local function A()U:Ready()for l=1,G,1 do if n.TextTransparency>O then n.TextTransparency=n.TextTransparency-r K.TextTransparency=K.TextTransparency-r end if n.TextStrokeTransparency>D then n.TextStrokeTransparency=n.TextStrokeTransparency-m K.TextStrokeTransparency=K.TextStrokeTransparency-m end if d.BackgroundTransparency>s then d.BackgroundTransparency=d.BackgroundTransparency-h end service.Wait("\083\116\101\112\112\101\100")end end local function p()if not y then y=true for l=1,G,1 do if n.TextTransparency<1 then n.TextTransparency=n.TextTransparency+r K.TextTransparency=K.TextTransparency+r end if n.TextStrokeTransparency<1 then n.TextStrokeTransparency=n.TextStrokeTransparency+m K.TextStrokeTransparency=K.TextStrokeTransparency+m end if d.BackgroundTransparency<1 then d.BackgroundTransparency=d.BackgroundTransparency+h u.BackgroundTransparency=d.BackgroundTransparency end service.Wait("\083\116\101\112\112\101\100")end;(service.UnWrap(a)):Destroy()end end U.CustomDestroy=function()p()end A()if not w then local l,a=I:gsub(" ","")a=math.clamp(a/2,4,11)+1 wait(a)else wait(w)end if not y then p()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 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 = 10
	local blurSize = 10
	local textFade = 0.1
	local strokeFade = 0.5
	local frameFade = frame.BackgroundTransparency
	
	local blurStep = blurSize/fadeSteps
	local frameStep = frameFade/fadeSteps
	local textStep = 0.1
	local strokeStep = 0.1
	
	local function fadeIn()
		gTable:Ready()
		for i = 1,fadeSteps do
			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
				--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
		wait(time)
	else
		wait(tim)
	end
	if not gone then
		fadeOut()
	end
end
