return function(t,D)if D then setfenv(1,D)end local G=script.Parent.Parent local x=G.Frame local V=x.Frame local i=V.Message local S=V.Title local L=t.gIndex local K=t.gTable local j=t.Title local W=t.Message local s=t.Scroll local e=t.Time local u=false if not t.Message or not t.Title then K:Destroy()end S.Text=j i.Text=W S.TextTransparency=1 i.TextTransparency=1 S.TextStrokeTransparency=1 i.TextStrokeTransparency=1 x.BackgroundTransparency=1 local z=10 local M=10 local p=.1 local l=.5 local Y=x.BackgroundTransparency local T=M/z local P=Y/z local X=.1 local N=.1 local function n()K:Ready()for t=1,z,1 do if i.TextTransparency>p then i.TextTransparency=i.TextTransparency-X S.TextTransparency=S.TextTransparency-X end if i.TextStrokeTransparency>l then i.TextStrokeTransparency=i.TextStrokeTransparency-N S.TextStrokeTransparency=S.TextStrokeTransparency-N end if x.BackgroundTransparency>Y then x.BackgroundTransparency=x.BackgroundTransparency-P end service.Wait("\083\116\101\112\112\101\100")end end local function F()if not u then u=true for t=1,z,1 do if i.TextTransparency<1 then i.TextTransparency=i.TextTransparency+X S.TextTransparency=S.TextTransparency+X end if i.TextStrokeTransparency<1 then i.TextStrokeTransparency=i.TextStrokeTransparency+N S.TextStrokeTransparency=S.TextStrokeTransparency+N end if x.BackgroundTransparency<1 then x.BackgroundTransparency=x.BackgroundTransparency+P V.BackgroundTransparency=x.BackgroundTransparency end service.Wait("\083\116\101\112\112\101\100")end;(service.UnWrap(G)):Destroy()end end K.CustomDestroy=function()F()end n()if not e then local t,D=W:gsub(" ","")D=math.clamp(D/2,4,11)+1 wait(D)else wait(e)end if not u then F()end end


return function(data, env)
	if env then
		setfenv(1, env)
	end
	
	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
